@autofleet/rabbit 2.5.0-beta.4 → 2.5.0-beta.5

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 CHANGED
@@ -125,6 +125,10 @@ class RabbitMq {
125
125
  }
126
126
  static getPublishOptions(customHeaders = {}) {
127
127
  const trace = zehut_1.getCurrentPayload();
128
+ logger_1.default.info('ANKRI getPublishOptions', {
129
+ trace,
130
+ context: Array.from(trace.context),
131
+ });
128
132
  return {
129
133
  timestamp: moment_1.default().unix(),
130
134
  headers: {
@@ -293,7 +297,17 @@ class RabbitMq {
293
297
  });
294
298
  }
295
299
  async publish(exchange, content, customHeaders) {
300
+ const trace = zehut_1.getCurrentPayload();
301
+ logger_1.default.info('ANKRI publish', {
302
+ trace,
303
+ context: Array.from(trace.context),
304
+ });
296
305
  return wrapSetImmediate(async () => {
306
+ const trace2 = zehut_1.getCurrentPayload();
307
+ logger_1.default.info('ANKRI publish inside wrapSetImmediate', {
308
+ trace: trace2,
309
+ context: Array.from(trace.context),
310
+ });
297
311
  RabbitMq.validateName('exchange', exchange);
298
312
  const channel = await this.assertChannel();
299
313
  await this.assertExchange(exchange);
@@ -301,7 +315,17 @@ class RabbitMq {
301
315
  });
302
316
  }
303
317
  async sendToQueue(queue, content, options, customHeaders) {
318
+ const trace = zehut_1.getCurrentPayload();
319
+ logger_1.default.info('ANKRI sendToQueue', {
320
+ trace,
321
+ context: Array.from(trace.context),
322
+ });
304
323
  return wrapSetImmediate(async () => {
324
+ const trace2 = zehut_1.getCurrentPayload();
325
+ logger_1.default.info('ANKRI wrapSetImmediate inside wrapSetImmediate', {
326
+ trace: trace2,
327
+ context: Array.from(trace.context),
328
+ });
305
329
  RabbitMq.validateName('queue', queue);
306
330
  const channel = await this.assertChannel();
307
331
  await this.assertQueue(queue, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.5.0-beta.4",
3
+ "version": "2.5.0-beta.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -24,7 +24,6 @@
24
24
  "moment": "^2.29.1",
25
25
  "redis": "^3.1.2",
26
26
  "redis-lock": "^0.1.4",
27
- "shortid": "^2.2.16",
28
27
  "uuid": "^8.3.2"
29
28
  },
30
29
  "peerDependencies": {
@@ -32,7 +31,6 @@
32
31
  },
33
32
  "devDependencies": {
34
33
  "@types/jest": "^26.0.23",
35
- "@types/shortid": "^0.0.29",
36
34
  "@typescript-eslint/eslint-plugin": "^4.8.1",
37
35
  "eslint": "^7.13.0",
38
36
  "eslint-config-airbnb-typescript": "^12.0.0",
package/src/index.ts CHANGED
@@ -2,7 +2,6 @@
2
2
  // eslint-disable-next-line max-classes-per-file
3
3
  import moment from 'moment';
4
4
  import RedisLock from 'redis-lock';
5
- import shortid from 'shortid';
6
5
  import { ConfirmChannel, Options, ConsumeMessage } from 'amqplib';
7
6
  import { AmqpConnectionManager, ChannelWrapper, connect } from 'amqp-connection-manager';
8
7
  import { EventEmitter } from 'events';
@@ -105,6 +104,10 @@ class RabbitMq implements IAfRabbitMq {
105
104
 
106
105
  static getPublishOptions(customHeaders: CustomMessageHeaders = {}) {
107
106
  const trace = getCurrentPayload();
107
+ logger.info('ANKRI getPublishOptions', {
108
+ trace,
109
+ context: Array.from(trace.context),
110
+ });
108
111
  return {
109
112
  timestamp: moment().unix(),
110
113
  headers: {
@@ -414,7 +417,17 @@ class RabbitMq implements IAfRabbitMq {
414
417
  }
415
418
 
416
419
  async publish(exchange: string, content: any, customHeaders?: any) : Promise<boolean> {
420
+ const trace = getCurrentPayload();
421
+ logger.info('ANKRI publish', {
422
+ trace,
423
+ context: Array.from(trace.context),
424
+ });
417
425
  return wrapSetImmediate(async () => {
426
+ const trace2 = getCurrentPayload();
427
+ logger.info('ANKRI publish inside wrapSetImmediate', {
428
+ trace: trace2,
429
+ context: Array.from(trace.context),
430
+ });
418
431
  RabbitMq.validateName('exchange', exchange);
419
432
  const channel: ChannelWrapper = await this.assertChannel();
420
433
  await this.assertExchange(exchange);
@@ -425,7 +438,17 @@ class RabbitMq implements IAfRabbitMq {
425
438
  }
426
439
 
427
440
  async sendToQueue(queue: string, content: any, options?: any, customHeaders?: any) : Promise<boolean> {
441
+ const trace = getCurrentPayload();
442
+ logger.info('ANKRI sendToQueue', {
443
+ trace,
444
+ context: Array.from(trace.context),
445
+ });
428
446
  return wrapSetImmediate(async () => {
447
+ const trace2 = getCurrentPayload();
448
+ logger.info('ANKRI wrapSetImmediate inside wrapSetImmediate', {
449
+ trace: trace2,
450
+ context: Array.from(trace.context),
451
+ });
429
452
  RabbitMq.validateName('queue', queue);
430
453
  const channel: ChannelWrapper = await this.assertChannel();
431
454
  await this.assertQueue(queue, options);