@autofleet/rabbit 2.2.4-beta-1 → 2.2.4-beta-2
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 +7 -7
- package/package.json +1 -1
- package/src/index.ts +6 -6
package/dist/index.js
CHANGED
|
@@ -299,18 +299,18 @@ class RabbitMq {
|
|
|
299
299
|
publish(exchange, content, customHeaders) {
|
|
300
300
|
return __awaiter(this, void 0, void 0, function* () {
|
|
301
301
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
setImmediate(() => __awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
try {
|
|
304
304
|
RabbitMq.validateName('exchange', exchange);
|
|
305
305
|
const channel = yield this.assertChannel();
|
|
306
306
|
yield this.assertExchange(exchange);
|
|
307
307
|
yield channel.publish(exchange, '', Buffer.from(JSON.stringify(content)), RabbitMq.getPublishOptions(customHeaders));
|
|
308
308
|
resolve(true);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
reject(error);
|
|
312
|
+
}
|
|
313
|
+
}));
|
|
314
314
|
}));
|
|
315
315
|
});
|
|
316
316
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -376,8 +376,8 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
376
376
|
|
|
377
377
|
async publish(exchange: string, content: any, customHeaders?: any) : Promise<any> {
|
|
378
378
|
return new Promise<any>(async (resolve, reject) => {
|
|
379
|
-
|
|
380
|
-
|
|
379
|
+
setImmediate(async () => {
|
|
380
|
+
try {
|
|
381
381
|
RabbitMq.validateName('exchange', exchange);
|
|
382
382
|
const channel: ChannelWrapper = await this.assertChannel();
|
|
383
383
|
await this.assertExchange(exchange);
|
|
@@ -385,10 +385,10 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
385
385
|
Buffer.from(JSON.stringify(content)),
|
|
386
386
|
RabbitMq.getPublishOptions(customHeaders));
|
|
387
387
|
resolve(true);
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
}
|
|
388
|
+
} catch (error) {
|
|
389
|
+
reject(error);
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
392
|
});
|
|
393
393
|
}
|
|
394
394
|
|