@autofleet/rabbit 2.2.2 → 2.2.4-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/.env ADDED
File without changes
package/dist/index.js CHANGED
@@ -234,8 +234,8 @@ class RabbitMq {
234
234
  yield releaseLock();
235
235
  return;
236
236
  }
237
- yield callback(msg, ack, nack);
238
237
  }
238
+ yield callback(msg, ack, nack);
239
239
  }
240
240
  catch (err) {
241
241
  if (releaseLock) {
@@ -298,10 +298,20 @@ class RabbitMq {
298
298
  }
299
299
  publish(exchange, content, customHeaders) {
300
300
  return __awaiter(this, void 0, void 0, function* () {
301
- RabbitMq.validateName('exchange', exchange);
302
- const channel = yield this.assertChannel();
303
- yield this.assertExchange(exchange);
304
- yield channel.publish(exchange, '', Buffer.from(JSON.stringify(content)), RabbitMq.getPublishOptions(customHeaders));
301
+ return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
302
+ try {
303
+ setImmediate(() => __awaiter(this, void 0, void 0, function* () {
304
+ RabbitMq.validateName('exchange', exchange);
305
+ const channel = yield this.assertChannel();
306
+ yield this.assertExchange(exchange);
307
+ yield channel.publish(exchange, '', Buffer.from(JSON.stringify(content)), RabbitMq.getPublishOptions(customHeaders));
308
+ resolve(true);
309
+ }));
310
+ }
311
+ catch (error) {
312
+ reject(error);
313
+ }
314
+ }));
305
315
  });
306
316
  }
307
317
  sendToQueue(queue, content, options, customHeaders) {
package/dump.rdb ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.2.2",
3
+ "version": "2.2.4-beta-1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -304,8 +304,8 @@ class RabbitMq implements IAfRabbitMq {
304
304
  await releaseLock();
305
305
  return;
306
306
  }
307
- await callback(msg, ack, nack);
308
307
  }
308
+ await callback(msg, ack, nack);
309
309
  } catch (err) {
310
310
  if (releaseLock) {
311
311
  await releaseLock();
@@ -375,12 +375,21 @@ class RabbitMq implements IAfRabbitMq {
375
375
  }
376
376
 
377
377
  async publish(exchange: string, content: any, customHeaders?: any) : Promise<any> {
378
- RabbitMq.validateName('exchange', exchange);
379
- const channel: ChannelWrapper = await this.assertChannel();
380
- await this.assertExchange(exchange);
381
- await channel.publish(exchange, '',
382
- Buffer.from(JSON.stringify(content)),
383
- RabbitMq.getPublishOptions(customHeaders));
378
+ return new Promise<any>(async (resolve, reject) => {
379
+ try {
380
+ setImmediate(async () => {
381
+ RabbitMq.validateName('exchange', exchange);
382
+ const channel: ChannelWrapper = await this.assertChannel();
383
+ await this.assertExchange(exchange);
384
+ await channel.publish(exchange, '',
385
+ Buffer.from(JSON.stringify(content)),
386
+ RabbitMq.getPublishOptions(customHeaders));
387
+ resolve(true);
388
+ });
389
+ } catch (error) {
390
+ reject(error);
391
+ }
392
+ });
384
393
  }
385
394
 
386
395
  async sendToQueue(queue: string, content: any, options?: any, customHeaders?: any) : Promise<boolean> {