@autofleet/rabbit 3.4.0-beta.15 → 3.4.0-beta.16
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 +42 -40
- package/package.json +1 -1
- package/src/index.ts +41 -41
package/dist/index.js
CHANGED
|
@@ -702,47 +702,49 @@ class RabbitMq {
|
|
|
702
702
|
}
|
|
703
703
|
// TODO: [QUORUM-PHASE-2] After changing the publish from old to new change from the old to the new implementation
|
|
704
704
|
async isConnected() {
|
|
705
|
-
|
|
705
|
+
// TODO: OLD IMPLEMENTATION
|
|
706
|
+
debug('rabbit: start old is connected');
|
|
707
|
+
const oldConsumeConnection = await this.getConnectionOld(this.oldConsumeConnection);
|
|
708
|
+
const oldPublishConnection = await this.getConnectionOld(this.oldPublishConnection);
|
|
709
|
+
const oldIsConnected = oldConsumeConnection.isConnected() && oldPublishConnection.isConnected();
|
|
710
|
+
if (!oldIsConnected) {
|
|
711
|
+
logger_1.default.error('rabbit: isConnected - false');
|
|
712
|
+
return false;
|
|
713
|
+
}
|
|
714
|
+
const oldChannel = await this.assertChannelOld({ connection: this.oldPublishConnection });
|
|
715
|
+
try {
|
|
716
|
+
await Promise.all([
|
|
717
|
+
oldChannel.waitForConnect(),
|
|
718
|
+
...this.oldConsumers.map((c) => oldChannel.checkQueue(c.queue)),
|
|
719
|
+
]);
|
|
720
|
+
}
|
|
721
|
+
catch (e) {
|
|
722
|
+
logger_1.default.error('rabbit: isConnected - false');
|
|
723
|
+
return false;
|
|
724
|
+
}
|
|
725
|
+
logger_1.default.debug('rabbit: old isConnected - true');
|
|
726
|
+
// TODO: NEW IMPLEMENTATION
|
|
727
|
+
debug('rabbit: start is connected');
|
|
728
|
+
const consumeConnection = await this.getConnection(this.consumeConnection);
|
|
729
|
+
const publishConnection = await this.getConnection(this.publishConnection);
|
|
730
|
+
const isConnected = consumeConnection.isConnected() && publishConnection.isConnected();
|
|
731
|
+
if (!isConnected) {
|
|
732
|
+
logger_1.default.error('rabbit: isConnected - false');
|
|
733
|
+
return false;
|
|
734
|
+
}
|
|
735
|
+
const channel = await this.assertChannel({ connection: this.publishConnection });
|
|
736
|
+
try {
|
|
737
|
+
await Promise.all([
|
|
738
|
+
channel.waitForConnect(),
|
|
739
|
+
...this.consumers.map((c) => channel.checkQueue(c.queue)),
|
|
740
|
+
]);
|
|
741
|
+
}
|
|
742
|
+
catch (e) {
|
|
743
|
+
logger_1.default.error('rabbit: isConnected - false');
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
logger_1.default.debug('rabbit: isConnected - true');
|
|
706
747
|
return true;
|
|
707
|
-
// debug('rabbit: start old is connected');
|
|
708
|
-
// const oldConsumeConnection = await this.getConnectionOld(this.oldConsumeConnection);
|
|
709
|
-
// const oldPublishConnection = await this.getConnectionOld(this.oldPublishConnection);
|
|
710
|
-
// const oldIsConnected = oldConsumeConnection.isConnected() && oldPublishConnection.isConnected();
|
|
711
|
-
// if (!oldIsConnected) {
|
|
712
|
-
// logger.error('rabbit: isConnected - false');
|
|
713
|
-
// return false;
|
|
714
|
-
// }
|
|
715
|
-
// const oldChannel: any = await this.assertChannelOld({ connection: this.oldPublishConnection });
|
|
716
|
-
// try {
|
|
717
|
-
// await Promise.all([
|
|
718
|
-
// oldChannel.waitForConnect(),
|
|
719
|
-
// ...this.oldConsumers.map((c: AfConsumer) => oldChannel.checkQueue(c.queue)),
|
|
720
|
-
// ]);
|
|
721
|
-
// } catch (e) {
|
|
722
|
-
// logger.error('rabbit: isConnected - false');
|
|
723
|
-
// return false;
|
|
724
|
-
// }
|
|
725
|
-
// logger.debug('rabbit: old isConnected - true');
|
|
726
|
-
// debug('rabbit: start is connected');
|
|
727
|
-
// const consumeConnection = await this.getConnection(this.oldConsumeConnection);
|
|
728
|
-
// const publishConnection = await this.getConnection(this.oldPublishConnection);
|
|
729
|
-
// const isConnected = consumeConnection.isConnected() && publishConnection.isConnected();
|
|
730
|
-
// if (!isConnected) {
|
|
731
|
-
// logger.error('rabbit: isConnected - false');
|
|
732
|
-
// return false;
|
|
733
|
-
// }
|
|
734
|
-
// const channel: any = await this.assertChannel({ connection: this.oldPublishConnection });
|
|
735
|
-
// try {
|
|
736
|
-
// await Promise.all([
|
|
737
|
-
// channel.waitForConnect(),
|
|
738
|
-
// ...this.oldConsumers.map((c: AfConsumer) => channel.checkQueue(c.queue)),
|
|
739
|
-
// ]);
|
|
740
|
-
// } catch (e) {
|
|
741
|
-
// logger.error('rabbit: isConnected - false');
|
|
742
|
-
// return false;
|
|
743
|
-
// }
|
|
744
|
-
// logger.debug('rabbit: isConnected - true');
|
|
745
|
-
// return true;
|
|
746
748
|
}
|
|
747
749
|
async gracefulShutdown(signal) {
|
|
748
750
|
// TODO: [QUORUM-PHASE-2] After changing the publish from old to new change from the old to the new implementation
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -950,48 +950,48 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
950
950
|
|
|
951
951
|
// TODO: [QUORUM-PHASE-2] After changing the publish from old to new change from the old to the new implementation
|
|
952
952
|
async isConnected() : Promise<boolean> {
|
|
953
|
-
|
|
953
|
+
// TODO: OLD IMPLEMENTATION
|
|
954
|
+
debug('rabbit: start old is connected');
|
|
955
|
+
const oldConsumeConnection = await this.getConnectionOld(this.oldConsumeConnection);
|
|
956
|
+
const oldPublishConnection = await this.getConnectionOld(this.oldPublishConnection);
|
|
957
|
+
const oldIsConnected = oldConsumeConnection.isConnected() && oldPublishConnection.isConnected();
|
|
958
|
+
if (!oldIsConnected) {
|
|
959
|
+
logger.error('rabbit: isConnected - false');
|
|
960
|
+
return false;
|
|
961
|
+
}
|
|
962
|
+
const oldChannel: any = await this.assertChannelOld({ connection: this.oldPublishConnection });
|
|
963
|
+
try {
|
|
964
|
+
await Promise.all([
|
|
965
|
+
oldChannel.waitForConnect(),
|
|
966
|
+
...this.oldConsumers.map((c: AfConsumer) => oldChannel.checkQueue(c.queue)),
|
|
967
|
+
]);
|
|
968
|
+
} catch (e) {
|
|
969
|
+
logger.error('rabbit: isConnected - false');
|
|
970
|
+
return false;
|
|
971
|
+
}
|
|
972
|
+
logger.debug('rabbit: old isConnected - true');
|
|
973
|
+
|
|
974
|
+
// TODO: NEW IMPLEMENTATION
|
|
975
|
+
debug('rabbit: start is connected');
|
|
976
|
+
const consumeConnection = await this.getConnection(this.consumeConnection);
|
|
977
|
+
const publishConnection = await this.getConnection(this.publishConnection);
|
|
978
|
+
const isConnected = consumeConnection.isConnected() && publishConnection.isConnected();
|
|
979
|
+
if (!isConnected) {
|
|
980
|
+
logger.error('rabbit: isConnected - false');
|
|
981
|
+
return false;
|
|
982
|
+
}
|
|
983
|
+
const channel: any = await this.assertChannel({ connection: this.publishConnection });
|
|
984
|
+
try {
|
|
985
|
+
await Promise.all([
|
|
986
|
+
channel.waitForConnect(),
|
|
987
|
+
...this.consumers.map((c: AfConsumer) => channel.checkQueue(c.queue)),
|
|
988
|
+
]);
|
|
989
|
+
} catch (e) {
|
|
990
|
+
logger.error('rabbit: isConnected - false');
|
|
991
|
+
return false;
|
|
992
|
+
}
|
|
993
|
+
logger.debug('rabbit: isConnected - true');
|
|
954
994
|
return true;
|
|
955
|
-
// debug('rabbit: start old is connected');
|
|
956
|
-
// const oldConsumeConnection = await this.getConnectionOld(this.oldConsumeConnection);
|
|
957
|
-
// const oldPublishConnection = await this.getConnectionOld(this.oldPublishConnection);
|
|
958
|
-
// const oldIsConnected = oldConsumeConnection.isConnected() && oldPublishConnection.isConnected();
|
|
959
|
-
// if (!oldIsConnected) {
|
|
960
|
-
// logger.error('rabbit: isConnected - false');
|
|
961
|
-
// return false;
|
|
962
|
-
// }
|
|
963
|
-
// const oldChannel: any = await this.assertChannelOld({ connection: this.oldPublishConnection });
|
|
964
|
-
// try {
|
|
965
|
-
// await Promise.all([
|
|
966
|
-
// oldChannel.waitForConnect(),
|
|
967
|
-
// ...this.oldConsumers.map((c: AfConsumer) => oldChannel.checkQueue(c.queue)),
|
|
968
|
-
// ]);
|
|
969
|
-
// } catch (e) {
|
|
970
|
-
// logger.error('rabbit: isConnected - false');
|
|
971
|
-
// return false;
|
|
972
|
-
// }
|
|
973
|
-
// logger.debug('rabbit: old isConnected - true');
|
|
974
|
-
|
|
975
|
-
// debug('rabbit: start is connected');
|
|
976
|
-
// const consumeConnection = await this.getConnection(this.oldConsumeConnection);
|
|
977
|
-
// const publishConnection = await this.getConnection(this.oldPublishConnection);
|
|
978
|
-
// const isConnected = consumeConnection.isConnected() && publishConnection.isConnected();
|
|
979
|
-
// if (!isConnected) {
|
|
980
|
-
// logger.error('rabbit: isConnected - false');
|
|
981
|
-
// return false;
|
|
982
|
-
// }
|
|
983
|
-
// const channel: any = await this.assertChannel({ connection: this.oldPublishConnection });
|
|
984
|
-
// try {
|
|
985
|
-
// await Promise.all([
|
|
986
|
-
// channel.waitForConnect(),
|
|
987
|
-
// ...this.oldConsumers.map((c: AfConsumer) => channel.checkQueue(c.queue)),
|
|
988
|
-
// ]);
|
|
989
|
-
// } catch (e) {
|
|
990
|
-
// logger.error('rabbit: isConnected - false');
|
|
991
|
-
// return false;
|
|
992
|
-
// }
|
|
993
|
-
// logger.debug('rabbit: isConnected - true');
|
|
994
|
-
// return true;
|
|
995
995
|
}
|
|
996
996
|
|
|
997
997
|
async gracefulShutdown(signal: string) : Promise<void> {
|