@autofleet/rabbit 3.2.19-beta.0 → 3.2.19-beta.1
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 +14 -2
- package/package.json +1 -1
- package/src/index.ts +14 -2
package/dist/index.js
CHANGED
|
@@ -475,15 +475,27 @@ class RabbitMq {
|
|
|
475
475
|
async sendToQueue(queue, content, options, customHeaders, isBlocking) {
|
|
476
476
|
const callback = async () => {
|
|
477
477
|
try {
|
|
478
|
-
RabbitMq.validateName('queue', queue);
|
|
479
478
|
await this.assertChannel();
|
|
479
|
+
}
|
|
480
|
+
catch (e) {
|
|
481
|
+
logger_1.default.error(`rabbit sendToQueue: failed to send assert channel when sending to queue ${queue}`, { e });
|
|
482
|
+
throw e;
|
|
483
|
+
}
|
|
484
|
+
try {
|
|
485
|
+
RabbitMq.validateName('queue', queue);
|
|
480
486
|
await this.assertQueue(queue, options);
|
|
487
|
+
}
|
|
488
|
+
catch (e) {
|
|
489
|
+
logger_1.default.error(`rabbit sendToQueue: failed to assert queue ${queue}`, { e });
|
|
490
|
+
throw e;
|
|
491
|
+
}
|
|
492
|
+
try {
|
|
481
493
|
const res = await this.channel?.sendToQueue(queue, Buffer.from(JSON.stringify(content)), RabbitMq.getPublishOptions(customHeaders));
|
|
482
494
|
debug(`rabbit: sending to queue ${queue}`, { res });
|
|
483
495
|
return res;
|
|
484
496
|
}
|
|
485
497
|
catch (e) {
|
|
486
|
-
logger_1.default.error(`rabbit: failed to send to queue ${queue}`, { e });
|
|
498
|
+
logger_1.default.error(`rabbit sendToQueue: failed to send to queue ${queue}`, { e });
|
|
487
499
|
throw e;
|
|
488
500
|
}
|
|
489
501
|
};
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -657,16 +657,28 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
657
657
|
): Promise<boolean | undefined> {
|
|
658
658
|
const callback = async (): Promise<boolean | undefined> => {
|
|
659
659
|
try {
|
|
660
|
-
RabbitMq.validateName('queue', queue);
|
|
661
660
|
await this.assertChannel();
|
|
661
|
+
} catch (e) {
|
|
662
|
+
logger.error(`rabbit sendToQueue: failed to send assert channel when sending to queue ${queue}`, { e });
|
|
663
|
+
throw e;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
try {
|
|
667
|
+
RabbitMq.validateName('queue', queue);
|
|
662
668
|
await this.assertQueue(queue, options);
|
|
669
|
+
} catch (e) {
|
|
670
|
+
logger.error(`rabbit sendToQueue: failed to assert queue ${queue}`, { e });
|
|
671
|
+
throw e;
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
try {
|
|
663
675
|
const res = await this.channel?.sendToQueue(queue,
|
|
664
676
|
Buffer.from(JSON.stringify(content)),
|
|
665
677
|
RabbitMq.getPublishOptions(customHeaders));
|
|
666
678
|
debug(`rabbit: sending to queue ${queue}`, { res });
|
|
667
679
|
return res;
|
|
668
680
|
} catch (e) {
|
|
669
|
-
logger.error(`rabbit: failed to send to queue ${queue}`, { e });
|
|
681
|
+
logger.error(`rabbit sendToQueue: failed to send to queue ${queue}`, { e });
|
|
670
682
|
throw e;
|
|
671
683
|
}
|
|
672
684
|
};
|