@autofleet/rabbit 3.2.13-beta.14 → 3.2.13-beta.2

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 CHANGED
@@ -334,7 +334,6 @@ 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`);
338
337
  this.consumers.push({
339
338
  queue,
340
339
  callback,
@@ -344,6 +343,7 @@ class RabbitMq {
344
343
  }
345
344
  async consume(queue, callback, options) {
346
345
  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,7 +362,6 @@ 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);
366
365
  const uniqueId = uuid_1.v4();
367
366
  const { limit, deadMessageTtl, useConsumeWithLock, lockTimeout, auditContext, enableRabbitTrace, } = optionsWithDefaults;
368
367
  if (useConsumeWithLock) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "3.2.13-beta.14",
3
+ "version": "3.2.13-beta.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@autofleet/logger": "^1.2.8",
19
- "@autofleet/zehut": "3.0.6",
19
+ "@autofleet/zehut": "3.0.7",
20
20
  "@types/amqplib": "0.8.2",
21
21
  "@types/uuid": "^8.3.3",
22
22
  "amqp-connection-manager": "4.1.9",
@@ -28,7 +28,7 @@
28
28
  "uuid": "^8.3.2"
29
29
  },
30
30
  "peerDependencies": {
31
- "@autofleet/outbreak": "^0.2.1"
31
+ "@autofleet/outbreak": "^1.0.4"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/jest": "^26.0.23",
package/src/index.ts CHANGED
@@ -472,9 +472,8 @@ class RabbitMq implements IAfRabbitMq {
472
472
  }
473
473
 
474
474
  private saveConsumer(queue: string, callback: CallbackFunction, options: ConsumeOptions | undefined) {
475
- const isConsumerExist :boolean = this.consumers.some((consumer) => consumer.queue === queue);
475
+ const isConsumerExist = this.consumers.some((consumer) => consumer.queue === queue);
476
476
  if (!isConsumerExist) {
477
- logger.info(`rabbit: consumer: ${queue} saved in consumer array`);
478
477
  this.consumers.push({
479
478
  queue,
480
479
  callback,
@@ -485,6 +484,7 @@ class RabbitMq implements IAfRabbitMq {
485
484
 
486
485
  async consume(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any> {
487
486
  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,7 +510,6 @@ 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);
514
513
  const uniqueId = v4();
515
514
  const {
516
515
  limit, deadMessageTtl, useConsumeWithLock, lockTimeout, auditContext, enableRabbitTrace,