@autofleet/rabbit 2.2.8-add-context-1 → 2.2.8

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.d.ts CHANGED
@@ -35,7 +35,7 @@ interface ConsumeOptions {
35
35
  }
36
36
  declare type CallbackFunction = (msg: ConsumeMessage, ack: Function, nack: Function) => Promise<any>;
37
37
  export interface AfRabbitOptions {
38
- reconnect: boolean;
38
+ disableReconnect: boolean;
39
39
  }
40
40
  declare class RabbitMq implements IAfRabbitMq {
41
41
  static parseMsg(msg: any): any;
package/dist/index.js CHANGED
@@ -18,7 +18,6 @@ const moment_1 = __importDefault(require("moment"));
18
18
  const redis_lock_1 = __importDefault(require("redis-lock"));
19
19
  const amqp_connection_manager_1 = require("amqp-connection-manager");
20
20
  const events_1 = require("events");
21
- const outbreak_1 = require("@autofleet/outbreak");
22
21
  // import { newTrace, traceTypes } from '@autofleet/outbreak';
23
22
  const util_1 = require("util");
24
23
  const logger_1 = __importDefault(require("./logger"));
@@ -146,12 +145,12 @@ class RabbitMq {
146
145
  var _a;
147
146
  this.exchanges = {};
148
147
  this.queues = {};
149
- if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.reconnect) {
150
- logger_1.default.error(`${this.RESCONNECT_MSG}${err && ` - ${err}`}`);
151
- this.connection = null;
148
+ if ((_a = this.options) === null || _a === void 0 ? void 0 : _a.disableReconnect) {
149
+ logger_1.default.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`);
152
150
  }
153
151
  else {
154
- logger_1.default.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`);
152
+ logger_1.default.error(`${this.RESCONNECT_MSG}${err && ` - ${err}`}`);
153
+ this.connection = null;
155
154
  }
156
155
  });
157
156
  this.creatingConnection = false;
@@ -284,7 +283,6 @@ class RabbitMq {
284
283
  return this.ack(channel, msg)(msg);
285
284
  }
286
285
  try {
287
- outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
288
286
  yield callback(parsedMessage, this.ack(channel, msg, true), this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl }, msg));
289
287
  }
290
288
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.2.8-add-context-1",
3
+ "version": "2.2.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -5,7 +5,6 @@ import RedisLock from 'redis-lock';
5
5
  import { ConfirmChannel, Options, ConsumeMessage } from 'amqplib';
6
6
  import { AmqpConnectionManager, ChannelWrapper, connect } from 'amqp-connection-manager';
7
7
  import { EventEmitter } from 'events';
8
- import { newTrace, traceTypes } from '@autofleet/outbreak';
9
8
  // import { newTrace, traceTypes } from '@autofleet/outbreak';
10
9
  import { promisify } from 'util';
11
10
  import logger from './logger';
@@ -50,7 +49,7 @@ interface ConsumeOptions {
50
49
  type CallbackFunction = (msg: ConsumeMessage, ack: Function, nack: Function) => Promise<any>
51
50
 
52
51
  export interface AfRabbitOptions {
53
- reconnect: boolean;
52
+ disableReconnect: boolean;
54
53
  }
55
54
 
56
55
  const DEFAULT_DEAD_TTL_TWO_DAYS = 60000 * 60 * 48;
@@ -225,11 +224,11 @@ class RabbitMq implements IAfRabbitMq {
225
224
  ({ err }) => {
226
225
  this.exchanges = {};
227
226
  this.queues = {};
228
- if (this.options?.reconnect) {
227
+ if (this.options?.disableReconnect) {
228
+ logger.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`);
229
+ } else {
229
230
  logger.error(`${this.RESCONNECT_MSG}${err && ` - ${err}`}`);
230
231
  this.connection = null;
231
- } else {
232
- logger.error(`${this.DISCONNECT_MSG}${err && ` - ${err}`}`);
233
232
  }
234
233
  });
235
234
  this.creatingConnection = false;
@@ -357,7 +356,6 @@ class RabbitMq implements IAfRabbitMq {
357
356
  return this.ack(channel, msg)(msg);
358
357
  }
359
358
  try {
360
- newTrace(traceTypes.RABBIT);
361
359
  await callback(
362
360
  parsedMessage,
363
361
  this.ack(channel, msg, true),