@autofleet/rabbit 3.4.0-beta.11 → 3.4.0-beta.12

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.
Files changed (3) hide show
  1. package/dist/index.js +20 -22
  2. package/package.json +1 -1
  3. package/src/index.ts +24 -25
package/dist/index.js CHANGED
@@ -486,10 +486,10 @@ class RabbitMq {
486
486
  // Used by the microservices to consume messages from the queue
487
487
  async consume(queue, callback, options) {
488
488
  // TODO: [QUORUM-PHASE-3] Use only the implementation of consumeNew and delete consumeNew and consumeOld
489
- // if (options?.isQuorumQueue !== false) {
490
- // await this.assertVHost();
491
- // await this.consumeNew(queue, callback, options);
492
- // }
489
+ if (options?.isQuorumQueue !== false) {
490
+ await this.assertVHost();
491
+ await this.consumeNew(queue, callback, options);
492
+ }
493
493
  await this.consumeOld(queue, callback, options);
494
494
  }
495
495
  // TODO: [QUORUM-PHASE-3] Delete consumeNew we do not use it anymore
@@ -629,24 +629,22 @@ class RabbitMq {
629
629
  ]);
630
630
  });
631
631
  }
632
- else {
633
- // TODO: [QUORUM-PHASE-3] Delete the old implementation
634
- await this.saveConsumerOld(queue, callback, options);
635
- const channelOld = await this.getNewChannelOld({
636
- name: `consume-exchange-${exchange}-queue-${queue}-old`,
637
- connection: this.oldConsumeConnection,
638
- });
639
- await channelOld.addSetup(async (c) => {
640
- const assertExchange = await (0, utils_1.assertExchangeFanout)(c, exchange);
641
- await c.assertQueue(queue);
642
- this.oldExchanges[exchange] = assertExchange;
643
- await c.prefetch(limit, false);
644
- return Promise.all([
645
- c.bindQueue(queue, exchange, ''),
646
- this.consumeOld(queue, callback, options),
647
- ]);
648
- });
649
- }
632
+ // TODO: [QUORUM-PHASE-3] Delete the old implementation
633
+ await this.saveConsumerOld(queue, callback, options);
634
+ const channelOld = await this.getNewChannelOld({
635
+ name: `consume-exchange-${exchange}-queue-${queue}-old`,
636
+ connection: this.oldConsumeConnection,
637
+ });
638
+ await channelOld.addSetup(async (c) => {
639
+ const assertExchange = await (0, utils_1.assertExchangeFanout)(c, exchange);
640
+ await c.assertQueue(queue);
641
+ this.oldExchanges[exchange] = assertExchange;
642
+ await c.prefetch(limit, false);
643
+ return Promise.all([
644
+ c.bindQueue(queue, exchange, ''),
645
+ this.consumeOld(queue, callback, options),
646
+ ]);
647
+ });
650
648
  }
651
649
  // Used by the microservices to publish messages to the exchange
652
650
  // TODO: [QUORUM-PHASE-2] Change the implementation to the new one
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "3.4.0-beta.11",
3
+ "version": "3.4.0-beta.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
package/src/index.ts CHANGED
@@ -692,10 +692,10 @@ class RabbitMq implements IAfRabbitMq {
692
692
  // Used by the microservices to consume messages from the queue
693
693
  async consume(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any> {
694
694
  // TODO: [QUORUM-PHASE-3] Use only the implementation of consumeNew and delete consumeNew and consumeOld
695
- // if (options?.isQuorumQueue !== false) {
696
- // await this.assertVHost();
697
- // await this.consumeNew(queue, callback, options);
698
- // }
695
+ if (options?.isQuorumQueue !== false) {
696
+ await this.assertVHost();
697
+ await this.consumeNew(queue, callback, options);
698
+ }
699
699
 
700
700
  await this.consumeOld(queue, callback, options);
701
701
  }
@@ -863,28 +863,27 @@ class RabbitMq implements IAfRabbitMq {
863
863
  ),
864
864
  ]);
865
865
  });
866
- } else {
867
- // TODO: [QUORUM-PHASE-3] Delete the old implementation
868
- await this.saveConsumerOld(queue, callback, options);
869
- const channelOld: ChannelWrapper = await this.getNewChannelOld({
870
- name: `consume-exchange-${exchange}-queue-${queue}-old`,
871
- connection: this.oldConsumeConnection,
872
- });
873
- await channelOld.addSetup(async (c: ConfirmChannel) => {
874
- const assertExchange = await assertExchangeFanout(c, exchange);
875
- await c.assertQueue(queue);
876
- this.oldExchanges[exchange] = assertExchange;
877
- await c.prefetch(limit, false);
878
- return Promise.all([
879
- c.bindQueue(queue, exchange, ''),
880
- this.consumeOld(
881
- queue,
882
- callback,
883
- options,
884
- ),
885
- ]);
886
- });
887
866
  }
867
+ // TODO: [QUORUM-PHASE-3] Delete the old implementation
868
+ await this.saveConsumerOld(queue, callback, options);
869
+ const channelOld: ChannelWrapper = await this.getNewChannelOld({
870
+ name: `consume-exchange-${exchange}-queue-${queue}-old`,
871
+ connection: this.oldConsumeConnection,
872
+ });
873
+ await channelOld.addSetup(async (c: ConfirmChannel) => {
874
+ const assertExchange = await assertExchangeFanout(c, exchange);
875
+ await c.assertQueue(queue);
876
+ this.oldExchanges[exchange] = assertExchange;
877
+ await c.prefetch(limit, false);
878
+ return Promise.all([
879
+ c.bindQueue(queue, exchange, ''),
880
+ this.consumeOld(
881
+ queue,
882
+ callback,
883
+ options,
884
+ ),
885
+ ]);
886
+ });
888
887
  }
889
888
 
890
889
  // Used by the microservices to publish messages to the exchange