diff --git a/src/consumer.ts b/src/consumer.ts index d5a4ff2..7a3b44c 100644 --- a/src/consumer.ts +++ b/src/consumer.ts @@ -47,8 +47,8 @@ export class Consumer { throw new Error('workerFn is required'); } - if (!qname) { - throw new Error('qname is required'); + if (!qname || qname === defaultOptions.INTERNALS) { + throw new Error(`qname cannot be empty or set as "${defaultOptions.INTERNALS}"`); } this.consumers = []; diff --git a/src/producer.ts b/src/producer.ts index 5e3b30f..9a0fad4 100644 --- a/src/producer.ts +++ b/src/producer.ts @@ -38,8 +38,8 @@ export class Producer { this._redis = new IORedis(this._redisOptions) as Redis; } - if (!qname) { - throw new Error('qname is required'); + if (!qname || qname === defaultOptions.INTERNALS) { + throw new Error(`qname cannot be empty or set as "${defaultOptions.INTERNALS}"`); } this._QNAME = `${defaultOptions.NAMESPACE}:queue:${qname}`;