@autofleet/rabbit 3.4.0-beta.15 → 3.4.0-beta.17

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 +42 -111
  2. package/package.json +1 -1
  3. package/src/index.ts +42 -100
package/dist/index.js CHANGED
@@ -231,12 +231,6 @@ class RabbitMq {
231
231
  async getConnection(connection) {
232
232
  return new Promise(async (resolve, reject) => {
233
233
  const { connection: connectionLocal, creatingConnection, connectionCreatedEventName, connectionFailedEventName, blockReconnect, } = connection;
234
- if (connection === this.publishConnection) {
235
- debug('rabbit: getConnection publish', { connectionLocal, creatingConnection, blockReconnect });
236
- }
237
- else if (connection === this.consumeConnection) {
238
- debug('rabbit: getConnection consume', { connectionLocal, creatingConnection, blockReconnect });
239
- }
240
234
  if (blockReconnect) {
241
235
  debug('rabbit: block reconnect');
242
236
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -244,12 +238,6 @@ class RabbitMq {
244
238
  return resolve();
245
239
  }
246
240
  if (connectionLocal !== null) {
247
- if (connection === this.publishConnection) {
248
- debug('rabbit: getConnection publish getConnection is not null', { connectionLocal });
249
- }
250
- else if (connection === this.consumeConnection) {
251
- debug('rabbit: getConnection consume getConnection is not null', { connectionLocal });
252
- }
253
241
  if (this.options?.disableReconnect || connectionLocal?.isConnected()) {
254
242
  debug('rabbit: connection - is connected');
255
243
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -281,12 +269,6 @@ class RabbitMq {
281
269
  findServers,
282
270
  });
283
271
  connection.connection = newConnection;
284
- if (connection === this.publishConnection) {
285
- debug('rabbit: publishConnection set');
286
- }
287
- else if (connection === this.consumeConnection) {
288
- debug('rabbit: consumeConnection set');
289
- }
290
272
  newConnection.on('error', (err) => {
291
273
  logger_1.default.error('rabbit: connection error', { err });
292
274
  if (!isResolved) {
@@ -334,12 +316,6 @@ class RabbitMq {
334
316
  logger_1.default.error(`rabbit: error on get connection for new channel ${name} `, { e });
335
317
  throw e;
336
318
  }
337
- if (connection === this.publishConnection) {
338
- debug('rabbit: getNewChannel publish', { localConnection });
339
- }
340
- else if (connection === this.consumeConnection) {
341
- debug('rabbit: getNewChannel consume', { localConnection });
342
- }
343
319
  const channel = localConnection?.createChannel({ ...options });
344
320
  (0, events_1.once)(channel, 'close').then((args) => {
345
321
  logger_1.default.error(`rabbit: channel ${name} closed`);
@@ -356,15 +332,6 @@ class RabbitMq {
356
332
  }
357
333
  }
358
334
  async assertChannel({ force = false, connection }) {
359
- if (connection === this.publishConnection) {
360
- debug('rabbit: assertChannel publish', { force, promiseSetup: this.oldPublishChannelSetupPromise });
361
- }
362
- else if (connection === this.consumeConnection) {
363
- debug('rabbit: assertChannel consume', { force, promiseSetup: this.oldPublishChannelSetupPromise });
364
- }
365
- else {
366
- debug('rabbit: assertChannel with undefined connection', { force, promiseSetup: this.oldPublishChannelSetupPromise, connection });
367
- }
368
335
  if (!this.publishChannelSetupPromise) {
369
336
  this.publishChannelSetupPromise = new Promise(async (resolve, reject) => {
370
337
  if (this.publishChannel && !force) {
@@ -702,47 +669,49 @@ class RabbitMq {
702
669
  }
703
670
  // TODO: [QUORUM-PHASE-2] After changing the publish from old to new change from the old to the new implementation
704
671
  async isConnected() {
705
- debug('rabbit: start old is connected', { connection: this.oldPublishConnection.connectionCreatedEventName });
672
+ // TODO: OLD IMPLEMENTATION
673
+ debug('rabbit: start old is connected');
674
+ const oldConsumeConnection = await this.getConnectionOld(this.oldConsumeConnection);
675
+ const oldPublishConnection = await this.getConnectionOld(this.oldPublishConnection);
676
+ const oldIsConnected = oldConsumeConnection.isConnected() && oldPublishConnection.isConnected();
677
+ if (!oldIsConnected) {
678
+ logger_1.default.error('rabbit: old isConnected - false');
679
+ return false;
680
+ }
681
+ const oldChannel = await this.assertChannelOld({ connection: this.oldPublishConnection });
682
+ try {
683
+ await Promise.all([
684
+ oldChannel.waitForConnect(),
685
+ ...this.oldConsumers.map((c) => oldChannel.checkQueue(c.queue)),
686
+ ]);
687
+ }
688
+ catch (e) {
689
+ logger_1.default.error('rabbit: old isConnected - false');
690
+ return false;
691
+ }
692
+ logger_1.default.debug('rabbit: old isConnected - true');
693
+ // TODO: NEW IMPLEMENTATION
694
+ debug('rabbit: start is connected');
695
+ const consumeConnection = await this.getConnection(this.consumeConnection);
696
+ const publishConnection = await this.getConnection(this.publishConnection);
697
+ const isConnected = consumeConnection.isConnected() && publishConnection.isConnected();
698
+ if (!isConnected) {
699
+ logger_1.default.error('rabbit: isConnected - false');
700
+ return false;
701
+ }
702
+ const channel = await this.assertChannel({ connection: this.publishConnection });
703
+ try {
704
+ await Promise.all([
705
+ channel.waitForConnect(),
706
+ ...this.consumers.map((c) => channel.checkQueue(c.queue)),
707
+ ]);
708
+ }
709
+ catch (e) {
710
+ logger_1.default.error('rabbit: isConnected - false');
711
+ return false;
712
+ }
713
+ logger_1.default.debug('rabbit: isConnected - true');
706
714
  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
715
  }
747
716
  async gracefulShutdown(signal) {
748
717
  // TODO: [QUORUM-PHASE-2] After changing the publish from old to new change from the old to the new implementation
@@ -764,7 +733,6 @@ class RabbitMq {
764
733
  }
765
734
  async consumeFromRabbitOld(queue, callback, options) {
766
735
  const optionsWithDefaults = { ...consts_1.DEFAULT_OPTIONS, ...options };
767
- debug('rabbit: consumeFromRabbitOld', { queue });
768
736
  RabbitMq.validateName('queue', queue);
769
737
  this.saveConsumerOld(queue, callback, options);
770
738
  const uniqueId = (0, node_crypto_1.randomUUID)();
@@ -856,12 +824,6 @@ class RabbitMq {
856
824
  // TODO: [QUORUM-PHASE-3] Delete all the function under this line (getNewChannelOld, getConnectionOld, assertQueueOld, setupQueueOld, saveConsumerOld)
857
825
  async getNewChannelOld({ name = (0, utils_1.rand)().toString(), onClose = null, options = {}, connection, }) {
858
826
  let localConnection;
859
- if (connection === this.oldPublishConnection) {
860
- debug('rabbit: getConnectionOld publish', { connection });
861
- }
862
- else if (connection === this.oldConsumeConnection) {
863
- debug('rabbit: getConnectionOld consume', { connection });
864
- }
865
827
  try {
866
828
  localConnection = await this.getConnectionOld(connection);
867
829
  }
@@ -872,12 +834,6 @@ class RabbitMq {
872
834
  if (!localConnection) {
873
835
  throw new Error(`rabbit: couldnt get connection for new channel ${name}`);
874
836
  }
875
- if (connection === this.oldPublishConnection) {
876
- debug('rabbit: getNewChannelOld publish', { localConnection });
877
- }
878
- else if (connection === this.oldConsumeConnection) {
879
- debug('rabbit: getNewChannelOld consume', { localConnection });
880
- }
881
837
  const channel = localConnection?.createChannel({ ...options });
882
838
  (0, events_1.once)(channel, 'close').then((args) => {
883
839
  logger_1.default.error(`rabbit: channel ${name} closed`);
@@ -896,12 +852,6 @@ class RabbitMq {
896
852
  async getConnectionOld(connection) {
897
853
  return new Promise(async (resolve, reject) => {
898
854
  const { connection: connectionLocal, creatingConnection, connectionCreatedEventName, connectionFailedEventName, blockReconnect, } = connection;
899
- if (connection === this.oldPublishConnection) {
900
- debug('rabbit: getConnectionOld publish', { connectionLocal, creatingConnection, blockReconnect });
901
- }
902
- else if (connection === this.oldConsumeConnection) {
903
- debug('rabbit: getConnectionOld consume', { connectionLocal, creatingConnection, blockReconnect });
904
- }
905
855
  if (blockReconnect) {
906
856
  debug('rabbit: block reconnect');
907
857
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -940,12 +890,6 @@ class RabbitMq {
940
890
  findServers,
941
891
  });
942
892
  connection.connection = newConnection;
943
- if (connection === this.oldPublishConnection) {
944
- debug('rabbit: oldPublishConnection set');
945
- }
946
- else if (connection === this.oldConsumeConnection) {
947
- debug('rabbit: oldConsumeConnection set');
948
- }
949
893
  newConnection.on('error', (err) => {
950
894
  logger_1.default.error('rabbit: connection error', { err });
951
895
  if (!isResolved) {
@@ -1045,12 +989,6 @@ class RabbitMq {
1045
989
  return queue;
1046
990
  }
1047
991
  async assertChannelOld({ force = false, connection }) {
1048
- if (connection === this.oldPublishConnection) {
1049
- debug('rabbit: assertChannelOld publish', { force, promiseSetup: this.oldPublishChannelSetupPromise });
1050
- }
1051
- else if (connection === this.oldConsumeConnection) {
1052
- debug('rabbit: assertChannelOld consume', { force, promiseSetup: this.oldPublishChannelSetupPromise });
1053
- }
1054
992
  if (!this.oldPublishChannelSetupPromise) {
1055
993
  this.oldPublishChannelSetupPromise = new Promise(async (resolve, reject) => {
1056
994
  if (this.oldPublishChannel && !force) {
@@ -1058,17 +996,10 @@ class RabbitMq {
1058
996
  }
1059
997
  try {
1060
998
  const channel = await this.getNewChannelOld({ connection });
1061
- if (connection === this.oldPublishConnection) {
1062
- debug('rabbit: old new channel got publish', { force, channel });
1063
- }
1064
- else if (connection === this.oldConsumeConnection) {
1065
- debug('rabbit: old new channel got consume', { force, channel });
1066
- }
1067
999
  channel.on('error', (err) => {
1068
1000
  logger_1.default.error('rabbit: channel error', { err });
1069
1001
  });
1070
1002
  if (this.oldPublishConnection === connection) {
1071
- debug('rabbit: a new channel assigned to the oldPublishChannel', { connection });
1072
1003
  this.oldPublishChannel = channel;
1073
1004
  }
1074
1005
  resolve(channel);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "3.4.0-beta.15",
3
+ "version": "3.4.0-beta.17",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "engines": {
package/src/index.ts CHANGED
@@ -416,11 +416,6 @@ class RabbitMq implements IAfRabbitMq {
416
416
  blockReconnect,
417
417
  } = connection;
418
418
 
419
- if (connection === this.publishConnection) {
420
- debug('rabbit: getConnection publish', { connectionLocal, creatingConnection, blockReconnect });
421
- } else if (connection === this.consumeConnection) {
422
- debug('rabbit: getConnection consume', { connectionLocal, creatingConnection, blockReconnect });
423
- }
424
419
  if (blockReconnect) {
425
420
  debug('rabbit: block reconnect');
426
421
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -428,11 +423,6 @@ class RabbitMq implements IAfRabbitMq {
428
423
  return resolve();
429
424
  }
430
425
  if (connectionLocal !== null) {
431
- if (connection === this.publishConnection) {
432
- debug('rabbit: getConnection publish getConnection is not null', { connectionLocal });
433
- } else if (connection === this.consumeConnection) {
434
- debug('rabbit: getConnection consume getConnection is not null', { connectionLocal });
435
- }
436
426
  if (this.options?.disableReconnect || connectionLocal?.isConnected()) {
437
427
  debug('rabbit: connection - is connected');
438
428
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -468,11 +458,6 @@ class RabbitMq implements IAfRabbitMq {
468
458
  });
469
459
 
470
460
  connection.connection = newConnection;
471
- if (connection === this.publishConnection) {
472
- debug('rabbit: publishConnection set');
473
- } else if (connection === this.consumeConnection) {
474
- debug('rabbit: consumeConnection set');
475
- }
476
461
  newConnection.on('error', (err) => {
477
462
  logger.error('rabbit: connection error', { err });
478
463
  if (!isResolved) {
@@ -524,11 +509,6 @@ class RabbitMq implements IAfRabbitMq {
524
509
  logger.error(`rabbit: error on get connection for new channel ${name} `, { e });
525
510
  throw e;
526
511
  }
527
- if (connection === this.publishConnection) {
528
- debug('rabbit: getNewChannel publish', { localConnection });
529
- } else if (connection === this.consumeConnection) {
530
- debug('rabbit: getNewChannel consume', { localConnection });
531
- }
532
512
  const channel = localConnection?.createChannel({ ...options });
533
513
  once(channel, 'close').then((args) => {
534
514
  logger.error(`rabbit: channel ${name} closed`);
@@ -545,13 +525,6 @@ class RabbitMq implements IAfRabbitMq {
545
525
  }
546
526
 
547
527
  async assertChannel({ force = false, connection }: assertChannelOpts): Promise<ChannelWrapper> {
548
- if (connection === this.publishConnection) {
549
- debug('rabbit: assertChannel publish', { force, promiseSetup: this.oldPublishChannelSetupPromise });
550
- } else if (connection === this.consumeConnection) {
551
- debug('rabbit: assertChannel consume', { force, promiseSetup: this.oldPublishChannelSetupPromise });
552
- } else {
553
- debug('rabbit: assertChannel with undefined connection', { force, promiseSetup: this.oldPublishChannelSetupPromise, connection });
554
- }
555
528
  if (!this.publishChannelSetupPromise) {
556
529
  this.publishChannelSetupPromise = new Promise<ChannelWrapper>(async (resolve, reject) => {
557
530
  if (this.publishChannel && !force) {
@@ -950,48 +923,48 @@ class RabbitMq implements IAfRabbitMq {
950
923
 
951
924
  // TODO: [QUORUM-PHASE-2] After changing the publish from old to new change from the old to the new implementation
952
925
  async isConnected() : Promise<boolean> {
953
- debug('rabbit: start old is connected', { connection: this.oldPublishConnection.connectionCreatedEventName });
926
+ // TODO: OLD IMPLEMENTATION
927
+ debug('rabbit: start old is connected');
928
+ const oldConsumeConnection = await this.getConnectionOld(this.oldConsumeConnection);
929
+ const oldPublishConnection = await this.getConnectionOld(this.oldPublishConnection);
930
+ const oldIsConnected = oldConsumeConnection.isConnected() && oldPublishConnection.isConnected();
931
+ if (!oldIsConnected) {
932
+ logger.error('rabbit: old isConnected - false');
933
+ return false;
934
+ }
935
+ const oldChannel: any = await this.assertChannelOld({ connection: this.oldPublishConnection });
936
+ try {
937
+ await Promise.all([
938
+ oldChannel.waitForConnect(),
939
+ ...this.oldConsumers.map((c: AfConsumer) => oldChannel.checkQueue(c.queue)),
940
+ ]);
941
+ } catch (e) {
942
+ logger.error('rabbit: old isConnected - false');
943
+ return false;
944
+ }
945
+ logger.debug('rabbit: old isConnected - true');
946
+
947
+ // TODO: NEW IMPLEMENTATION
948
+ debug('rabbit: start is connected');
949
+ const consumeConnection = await this.getConnection(this.consumeConnection);
950
+ const publishConnection = await this.getConnection(this.publishConnection);
951
+ const isConnected = consumeConnection.isConnected() && publishConnection.isConnected();
952
+ if (!isConnected) {
953
+ logger.error('rabbit: isConnected - false');
954
+ return false;
955
+ }
956
+ const channel: any = await this.assertChannel({ connection: this.publishConnection });
957
+ try {
958
+ await Promise.all([
959
+ channel.waitForConnect(),
960
+ ...this.consumers.map((c: AfConsumer) => channel.checkQueue(c.queue)),
961
+ ]);
962
+ } catch (e) {
963
+ logger.error('rabbit: isConnected - false');
964
+ return false;
965
+ }
966
+ logger.debug('rabbit: isConnected - true');
954
967
  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
968
  }
996
969
 
997
970
  async gracefulShutdown(signal: string) : Promise<void> {
@@ -1014,7 +987,6 @@ class RabbitMq implements IAfRabbitMq {
1014
987
 
1015
988
  private async consumeFromRabbitOld(queue: string, callback: CallbackFunction, options?: ConsumeOptions): Promise<any> {
1016
989
  const optionsWithDefaults = { ...DEFAULT_OPTIONS, ...options };
1017
- debug('rabbit: consumeFromRabbitOld', { queue });
1018
990
  RabbitMq.validateName('queue', queue);
1019
991
  this.saveConsumerOld(queue, callback, options);
1020
992
  const uniqueId = randomUUID();
@@ -1122,11 +1094,6 @@ class RabbitMq implements IAfRabbitMq {
1122
1094
  name = rand().toString(), onClose = null, options = {}, connection,
1123
1095
  }: newChannelOpts) {
1124
1096
  let localConnection!: AmqpConnectionManager;
1125
- if (connection === this.oldPublishConnection) {
1126
- debug('rabbit: getConnectionOld publish', { connection });
1127
- } else if (connection === this.oldConsumeConnection) {
1128
- debug('rabbit: getConnectionOld consume', { connection });
1129
- }
1130
1097
  try {
1131
1098
  localConnection = await this.getConnectionOld(connection);
1132
1099
  } catch (e) {
@@ -1137,11 +1104,7 @@ class RabbitMq implements IAfRabbitMq {
1137
1104
  if (!localConnection) {
1138
1105
  throw new Error(`rabbit: couldnt get connection for new channel ${name}`);
1139
1106
  }
1140
- if (connection === this.oldPublishConnection) {
1141
- debug('rabbit: getNewChannelOld publish', { localConnection });
1142
- } else if (connection === this.oldConsumeConnection) {
1143
- debug('rabbit: getNewChannelOld consume', { localConnection });
1144
- }
1107
+
1145
1108
  const channel = localConnection?.createChannel({ ...options });
1146
1109
  once(channel, 'close').then((args) => {
1147
1110
  logger.error(`rabbit: channel ${name} closed`);
@@ -1167,11 +1130,6 @@ class RabbitMq implements IAfRabbitMq {
1167
1130
  blockReconnect,
1168
1131
  } = connection;
1169
1132
 
1170
- if (connection === this.oldPublishConnection) {
1171
- debug('rabbit: getConnectionOld publish', { connectionLocal, creatingConnection, blockReconnect });
1172
- } else if (connection === this.oldConsumeConnection) {
1173
- debug('rabbit: getConnectionOld consume', { connectionLocal, creatingConnection, blockReconnect });
1174
- }
1175
1133
  if (blockReconnect) {
1176
1134
  debug('rabbit: block reconnect');
1177
1135
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1215,11 +1173,6 @@ class RabbitMq implements IAfRabbitMq {
1215
1173
  });
1216
1174
 
1217
1175
  connection.connection = newConnection;
1218
- if (connection === this.oldPublishConnection) {
1219
- debug('rabbit: oldPublishConnection set');
1220
- } else if (connection === this.oldConsumeConnection) {
1221
- debug('rabbit: oldConsumeConnection set');
1222
- }
1223
1176
  newConnection.on('error', (err) => {
1224
1177
  logger.error('rabbit: connection error', { err });
1225
1178
  if (!isResolved) {
@@ -1327,11 +1280,6 @@ class RabbitMq implements IAfRabbitMq {
1327
1280
  }
1328
1281
 
1329
1282
  async assertChannelOld({ force = false, connection }: assertChannelOpts): Promise<ChannelWrapper> {
1330
- if (connection === this.oldPublishConnection) {
1331
- debug('rabbit: assertChannelOld publish', { force, promiseSetup: this.oldPublishChannelSetupPromise });
1332
- } else if (connection === this.oldConsumeConnection) {
1333
- debug('rabbit: assertChannelOld consume', { force, promiseSetup: this.oldPublishChannelSetupPromise });
1334
- }
1335
1283
  if (!this.oldPublishChannelSetupPromise) {
1336
1284
  this.oldPublishChannelSetupPromise = new Promise<ChannelWrapper>(async (resolve, reject) => {
1337
1285
  if (this.oldPublishChannel && !force) {
@@ -1340,16 +1288,10 @@ class RabbitMq implements IAfRabbitMq {
1340
1288
 
1341
1289
  try {
1342
1290
  const channel = await this.getNewChannelOld({ connection });
1343
- if (connection === this.oldPublishConnection) {
1344
- debug('rabbit: old new channel got publish', { force, channel });
1345
- } else if (connection === this.oldConsumeConnection) {
1346
- debug('rabbit: old new channel got consume', { force, channel });
1347
- }
1348
1291
  channel.on('error', (err) => {
1349
1292
  logger.error('rabbit: channel error', { err });
1350
1293
  });
1351
1294
  if (this.oldPublishConnection === connection) {
1352
- debug('rabbit: a new channel assigned to the oldPublishChannel', { connection });
1353
1295
  this.oldPublishChannel = channel;
1354
1296
  }
1355
1297
  resolve(channel);