@autofleet/rabbit 3.4.0-beta.5 → 3.4.0-beta.7
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 +19 -17
- package/package.json +1 -1
- package/src/index.ts +22 -22
package/dist/index.js
CHANGED
|
@@ -322,7 +322,7 @@ class RabbitMq {
|
|
|
322
322
|
logger_1.default.error(`rabbit: error on get connection for new channel ${name} `, { e });
|
|
323
323
|
throw e;
|
|
324
324
|
}
|
|
325
|
-
const channel = localConnection
|
|
325
|
+
const channel = localConnection?.createChannel({ ...options });
|
|
326
326
|
(0, events_1.once)(channel, 'close').then((args) => {
|
|
327
327
|
logger_1.default.error(`rabbit: channel ${name} closed`);
|
|
328
328
|
onClose?.(args);
|
|
@@ -617,22 +617,24 @@ class RabbitMq {
|
|
|
617
617
|
]);
|
|
618
618
|
});
|
|
619
619
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
620
|
+
else {
|
|
621
|
+
// TODO: [QUORUM-PHASE-3] Delete the old implementation
|
|
622
|
+
await this.saveConsumerOld(queue, callback, options);
|
|
623
|
+
const channelOld = await this.getNewChannelOld({
|
|
624
|
+
name: `consume-exchange-${exchange}-queue-${queue}-old`,
|
|
625
|
+
connection: this.oldConsumeConnection,
|
|
626
|
+
});
|
|
627
|
+
await channelOld.addSetup(async (c) => {
|
|
628
|
+
const assertExchange = await (0, utils_1.assertExchangeFanout)(c, exchange);
|
|
629
|
+
await c.assertQueue(queue);
|
|
630
|
+
this.oldExchanges[exchange] = assertExchange;
|
|
631
|
+
await c.prefetch(limit, false);
|
|
632
|
+
return Promise.all([
|
|
633
|
+
c.bindQueue(queue, exchange, ''),
|
|
634
|
+
this.consumeOld(queue, callback, options),
|
|
635
|
+
]);
|
|
636
|
+
});
|
|
637
|
+
}
|
|
636
638
|
}
|
|
637
639
|
// Used by the microservices to publish messages to the exchange
|
|
638
640
|
// TODO: [QUORUM-PHASE-2] Change the implementation to the new one
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -513,7 +513,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
513
513
|
logger.error(`rabbit: error on get connection for new channel ${name} `, { e });
|
|
514
514
|
throw e;
|
|
515
515
|
}
|
|
516
|
-
const channel = localConnection
|
|
516
|
+
const channel = localConnection?.createChannel({ ...options });
|
|
517
517
|
once(channel, 'close').then((args) => {
|
|
518
518
|
logger.error(`rabbit: channel ${name} closed`);
|
|
519
519
|
onClose?.(args);
|
|
@@ -853,28 +853,28 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
853
853
|
),
|
|
854
854
|
]);
|
|
855
855
|
});
|
|
856
|
+
} else {
|
|
857
|
+
// TODO: [QUORUM-PHASE-3] Delete the old implementation
|
|
858
|
+
await this.saveConsumerOld(queue, callback, options);
|
|
859
|
+
const channelOld: ChannelWrapper = await this.getNewChannelOld({
|
|
860
|
+
name: `consume-exchange-${exchange}-queue-${queue}-old`,
|
|
861
|
+
connection: this.oldConsumeConnection,
|
|
862
|
+
});
|
|
863
|
+
await channelOld.addSetup(async (c: ConfirmChannel) => {
|
|
864
|
+
const assertExchange = await assertExchangeFanout(c, exchange);
|
|
865
|
+
await c.assertQueue(queue);
|
|
866
|
+
this.oldExchanges[exchange] = assertExchange;
|
|
867
|
+
await c.prefetch(limit, false);
|
|
868
|
+
return Promise.all([
|
|
869
|
+
c.bindQueue(queue, exchange, ''),
|
|
870
|
+
this.consumeOld(
|
|
871
|
+
queue,
|
|
872
|
+
callback,
|
|
873
|
+
options,
|
|
874
|
+
),
|
|
875
|
+
]);
|
|
876
|
+
});
|
|
856
877
|
}
|
|
857
|
-
|
|
858
|
-
// TODO: [QUORUM-PHASE-3] Delete the old implementation
|
|
859
|
-
await this.saveConsumerOld(queue, callback, options);
|
|
860
|
-
const channelOld: ChannelWrapper = await this.getNewChannelOld({
|
|
861
|
-
name: `consume-exchange-${exchange}-queue-${queue}-old`,
|
|
862
|
-
connection: this.oldConsumeConnection,
|
|
863
|
-
});
|
|
864
|
-
await channelOld.addSetup(async (c: ConfirmChannel) => {
|
|
865
|
-
const assertExchange = await assertExchangeFanout(c, exchange);
|
|
866
|
-
await c.assertQueue(queue);
|
|
867
|
-
this.oldExchanges[exchange] = assertExchange;
|
|
868
|
-
await c.prefetch(limit, false);
|
|
869
|
-
return Promise.all([
|
|
870
|
-
c.bindQueue(queue, exchange, ''),
|
|
871
|
-
this.consumeOld(
|
|
872
|
-
queue,
|
|
873
|
-
callback,
|
|
874
|
-
options,
|
|
875
|
-
),
|
|
876
|
-
]);
|
|
877
|
-
});
|
|
878
878
|
}
|
|
879
879
|
|
|
880
880
|
// Used by the microservices to publish messages to the exchange
|