@autofleet/rabbit 3.4.0-beta.13 → 3.4.0-beta.15
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 +17 -2
- package/package.json +1 -1
- package/src/index.ts +14 -2
package/dist/index.js
CHANGED
|
@@ -244,6 +244,12 @@ class RabbitMq {
|
|
|
244
244
|
return resolve();
|
|
245
245
|
}
|
|
246
246
|
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
|
+
}
|
|
247
253
|
if (this.options?.disableReconnect || connectionLocal?.isConnected()) {
|
|
248
254
|
debug('rabbit: connection - is connected');
|
|
249
255
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -313,7 +319,7 @@ class RabbitMq {
|
|
|
313
319
|
newConnection.once('connect', async () => {
|
|
314
320
|
debug('rabbit: connection established');
|
|
315
321
|
connection.creatingConnection = false;
|
|
316
|
-
this.em.emit(connectionCreatedEventName,
|
|
322
|
+
this.em.emit(connectionCreatedEventName, newConnection);
|
|
317
323
|
isResolved = true;
|
|
318
324
|
resolve(newConnection);
|
|
319
325
|
});
|
|
@@ -350,6 +356,15 @@ class RabbitMq {
|
|
|
350
356
|
}
|
|
351
357
|
}
|
|
352
358
|
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
|
+
}
|
|
353
368
|
if (!this.publishChannelSetupPromise) {
|
|
354
369
|
this.publishChannelSetupPromise = new Promise(async (resolve, reject) => {
|
|
355
370
|
if (this.publishChannel && !force) {
|
|
@@ -962,7 +977,7 @@ class RabbitMq {
|
|
|
962
977
|
newConnection.once('connect', async () => {
|
|
963
978
|
debug('rabbit: connection established');
|
|
964
979
|
connection.creatingConnection = false;
|
|
965
|
-
this.oldEm.emit(connectionCreatedEventName,
|
|
980
|
+
this.oldEm.emit(connectionCreatedEventName, newConnection);
|
|
966
981
|
isResolved = true;
|
|
967
982
|
resolve(newConnection);
|
|
968
983
|
});
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -428,6 +428,11 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
428
428
|
return resolve();
|
|
429
429
|
}
|
|
430
430
|
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
|
+
}
|
|
431
436
|
if (this.options?.disableReconnect || connectionLocal?.isConnected()) {
|
|
432
437
|
debug('rabbit: connection - is connected');
|
|
433
438
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
@@ -502,7 +507,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
502
507
|
newConnection.once('connect', async () => {
|
|
503
508
|
debug('rabbit: connection established');
|
|
504
509
|
connection.creatingConnection = false;
|
|
505
|
-
this.em.emit(connectionCreatedEventName,
|
|
510
|
+
this.em.emit(connectionCreatedEventName, newConnection);
|
|
506
511
|
isResolved = true;
|
|
507
512
|
resolve(newConnection);
|
|
508
513
|
});
|
|
@@ -540,6 +545,13 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
540
545
|
}
|
|
541
546
|
|
|
542
547
|
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
|
+
}
|
|
543
555
|
if (!this.publishChannelSetupPromise) {
|
|
544
556
|
this.publishChannelSetupPromise = new Promise<ChannelWrapper>(async (resolve, reject) => {
|
|
545
557
|
if (this.publishChannel && !force) {
|
|
@@ -1241,7 +1253,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
1241
1253
|
newConnection.once('connect', async () => {
|
|
1242
1254
|
debug('rabbit: connection established');
|
|
1243
1255
|
connection.creatingConnection = false;
|
|
1244
|
-
this.oldEm.emit(connectionCreatedEventName,
|
|
1256
|
+
this.oldEm.emit(connectionCreatedEventName, newConnection);
|
|
1245
1257
|
isResolved = true;
|
|
1246
1258
|
resolve(newConnection);
|
|
1247
1259
|
});
|