@autofleet/rabbit 3.2.13-beta.2 → 3.2.13-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/package.json +1 -1
- package/src/index.ts +3 -2
package/dist/index.js
CHANGED
|
@@ -334,6 +334,7 @@ class RabbitMq {
|
|
|
334
334
|
saveConsumer(queue, callback, options) {
|
|
335
335
|
const isConsumerExist = this.consumers.some((consumer) => consumer.queue === queue);
|
|
336
336
|
if (!isConsumerExist) {
|
|
337
|
+
logger_1.default.info(`rabbit: consumer: ${queue} saved in consumer array`);
|
|
337
338
|
this.consumers.push({
|
|
338
339
|
queue,
|
|
339
340
|
callback,
|
|
@@ -343,7 +344,6 @@ class RabbitMq {
|
|
|
343
344
|
}
|
|
344
345
|
async consume(queue, callback, options) {
|
|
345
346
|
await this.consumeFromRabbit(queue, callback, options);
|
|
346
|
-
return this.saveConsumer(queue, callback, options);
|
|
347
347
|
}
|
|
348
348
|
async lockRedisIfNeeded(msg, options) {
|
|
349
349
|
const { properties: { headers } } = msg;
|
|
@@ -362,6 +362,7 @@ class RabbitMq {
|
|
|
362
362
|
async consumeFromRabbit(queue, callback, options) {
|
|
363
363
|
const optionsWithDefaults = { ...consts_1.DEFAULT_OPTIONS, ...options };
|
|
364
364
|
RabbitMq.validateName('queue', queue);
|
|
365
|
+
this.saveConsumer(queue, callback, options);
|
|
365
366
|
const uniqueId = uuid_1.v4();
|
|
366
367
|
const { limit, deadMessageTtl, useConsumeWithLock, lockTimeout, auditContext, enableRabbitTrace, } = optionsWithDefaults;
|
|
367
368
|
if (useConsumeWithLock) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -472,8 +472,9 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
private saveConsumer(queue: string, callback: CallbackFunction, options: ConsumeOptions | undefined) {
|
|
475
|
-
const isConsumerExist = this.consumers.some((consumer) => consumer.queue === queue);
|
|
475
|
+
const isConsumerExist :boolean = this.consumers.some((consumer) => consumer.queue === queue);
|
|
476
476
|
if (!isConsumerExist) {
|
|
477
|
+
logger.info(`rabbit: consumer: ${queue} saved in consumer array`);
|
|
477
478
|
this.consumers.push({
|
|
478
479
|
queue,
|
|
479
480
|
callback,
|
|
@@ -484,7 +485,6 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
484
485
|
|
|
485
486
|
async consume(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any> {
|
|
486
487
|
await this.consumeFromRabbit(queue, callback, options);
|
|
487
|
-
return this.saveConsumer(queue, callback, options);
|
|
488
488
|
}
|
|
489
489
|
|
|
490
490
|
private async lockRedisIfNeeded(msg: any, options: any) {
|
|
@@ -510,6 +510,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
510
510
|
private async consumeFromRabbit(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any> {
|
|
511
511
|
const optionsWithDefaults = { ...DEFAULT_OPTIONS, ...options };
|
|
512
512
|
RabbitMq.validateName('queue', queue);
|
|
513
|
+
this.saveConsumer(queue, callback, options);
|
|
513
514
|
const uniqueId = v4();
|
|
514
515
|
const {
|
|
515
516
|
limit, deadMessageTtl, useConsumeWithLock, lockTimeout, auditContext, enableRabbitTrace,
|