@autofleet/rabbit 2.1.8-beta5 → 2.1.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 +3 -3
- package/dist/index.js +5 -5
- package/package.json +2 -2
- package/src/index.ts +6 -5
- package/.env +0 -0
- package/dump.rdb +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -50,13 +50,13 @@ declare class RabbitMq implements IAfRabbitMq {
|
|
|
50
50
|
getNewChannel(): Promise<ChannelWrapper>;
|
|
51
51
|
assertChannel(): Promise<ChannelWrapper>;
|
|
52
52
|
assertExchange(exchangeName: string, options?: any): Promise<any>;
|
|
53
|
-
getQueueLength(queue: string): Promise<
|
|
54
|
-
bindQueue(queue: string, exchange: string): Promise<
|
|
53
|
+
getQueueLength(queue: string): Promise<any>;
|
|
54
|
+
bindQueue(queue: string, exchange: string): Promise<any>;
|
|
55
55
|
assertQueue(queue: string, options?: Options.AssertQueue): Promise<void>;
|
|
56
56
|
consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any): Promise<void>;
|
|
57
57
|
consumeFromExchange(queue: string, exchange: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any): Promise<void>;
|
|
58
58
|
publish(exchange: string, content: any, customHeaders?: any): Promise<unknown>;
|
|
59
|
-
sendToQueue(queue: string, content: any, options?: any, customHeaders?: any): Promise<
|
|
59
|
+
sendToQueue(queue: string, content: any, options?: any, customHeaders?: any): Promise<void>;
|
|
60
60
|
isConnected(): Promise<boolean>;
|
|
61
61
|
}
|
|
62
62
|
export default RabbitMq;
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ const bluebird = __importStar(require("bluebird"));
|
|
|
37
37
|
const moment_1 = __importDefault(require("moment"));
|
|
38
38
|
const amqp_connection_manager_1 = require("amqp-connection-manager");
|
|
39
39
|
const events_1 = require("events");
|
|
40
|
-
|
|
40
|
+
const outbreak_1 = require("@autofleet/outbreak");
|
|
41
41
|
const logger_1 = __importDefault(require("./logger"));
|
|
42
42
|
const rabbitError_1 = __importDefault(require("./rabbitError"));
|
|
43
43
|
const redis_1 = __importDefault(require("./redis"));
|
|
@@ -123,7 +123,7 @@ class RabbitMq {
|
|
|
123
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
124
|
return new Promise((resolve) => __awaiter(this, void 0, void 0, function* () {
|
|
125
125
|
if (this.creatingConnection) {
|
|
126
|
-
this.em.
|
|
126
|
+
this.em.on(connectionCreatedConst, resolve);
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
if (this.connection !== null) {
|
|
@@ -163,8 +163,8 @@ class RabbitMq {
|
|
|
163
163
|
if (this.channel) {
|
|
164
164
|
return resolve(this.channel);
|
|
165
165
|
}
|
|
166
|
+
const connection = yield this.getConnection();
|
|
166
167
|
try {
|
|
167
|
-
const connection = yield this.getConnection();
|
|
168
168
|
if (this.channel === null) {
|
|
169
169
|
this.channel = connection.createChannel({});
|
|
170
170
|
}
|
|
@@ -223,7 +223,7 @@ class RabbitMq {
|
|
|
223
223
|
return Promise.all([
|
|
224
224
|
c.consume(queue, (msg) => __awaiter(this, void 0, void 0, function* () {
|
|
225
225
|
const parsedMessage = RabbitMq.parseMsg(msg);
|
|
226
|
-
|
|
226
|
+
outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
|
|
227
227
|
const shouldConsume = yield this.shouldConsumeMessageByTimestamp(parsedMessage);
|
|
228
228
|
logger_1.default.info('rabbit: trying to consume', { queue, shouldConsume, msg });
|
|
229
229
|
if (!shouldConsume) {
|
|
@@ -251,7 +251,7 @@ class RabbitMq {
|
|
|
251
251
|
c.bindQueue(queue, exchange, ''),
|
|
252
252
|
c.consume(queue, (msg) => __awaiter(this, void 0, void 0, function* () {
|
|
253
253
|
const parsedMessage = RabbitMq.parseMsg(msg);
|
|
254
|
-
|
|
254
|
+
outbreak_1.newTrace(outbreak_1.traceTypes.RABBIT);
|
|
255
255
|
const shouldConsume = yield this.shouldConsumeMessageByTimestamp(parsedMessage);
|
|
256
256
|
logger_1.default.info('rabbit: trying to consume', { queue, shouldConsume, msg });
|
|
257
257
|
if (!shouldConsume) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autofleet/rabbit",
|
|
3
|
-
"version": "2.1.8
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@types/amqp-connection-manager": "^2.0.10",
|
|
20
20
|
"@types/amqplib": "^0.5.16",
|
|
21
21
|
"@types/uuid": "^8.3.3",
|
|
22
|
-
"amqp-connection-manager": "^3.
|
|
22
|
+
"amqp-connection-manager": "^3.2.1",
|
|
23
23
|
"amqplib": "^0.6.0",
|
|
24
24
|
"bluebird": "^3.7.2",
|
|
25
25
|
"moment": "^2.29.1",
|
package/src/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ import moment from 'moment';
|
|
|
5
5
|
import { ConfirmChannel, Options } from 'amqplib';
|
|
6
6
|
import { AmqpConnectionManager, ChannelWrapper, connect } from 'amqp-connection-manager';
|
|
7
7
|
import { EventEmitter } from 'events';
|
|
8
|
-
|
|
8
|
+
import { newTrace, traceTypes } from '@autofleet/outbreak';
|
|
9
9
|
import logger from './logger';
|
|
10
10
|
import RabbitError from './rabbitError';
|
|
11
11
|
import getRedisInstance, { RedisConfig } from './redis';
|
|
@@ -159,7 +159,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
159
159
|
async getConnection() {
|
|
160
160
|
return new Promise<AmqpConnectionManager>(async (resolve) => {
|
|
161
161
|
if (this.creatingConnection) {
|
|
162
|
-
this.em.
|
|
162
|
+
this.em.on(connectionCreatedConst, resolve);
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
165
|
if (this.connection !== null) {
|
|
@@ -197,8 +197,9 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
197
197
|
return resolve(this.channel);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
const connection: AmqpConnectionManager = await this.getConnection();
|
|
201
|
+
|
|
200
202
|
try {
|
|
201
|
-
const connection: AmqpConnectionManager = await this.getConnection();
|
|
202
203
|
if (this.channel === null) {
|
|
203
204
|
this.channel = connection.createChannel({});
|
|
204
205
|
}
|
|
@@ -253,7 +254,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
253
254
|
queue,
|
|
254
255
|
async (msg: any) => {
|
|
255
256
|
const parsedMessage = RabbitMq.parseMsg(msg);
|
|
256
|
-
|
|
257
|
+
newTrace(traceTypes.RABBIT);
|
|
257
258
|
const shouldConsume = await this.shouldConsumeMessageByTimestamp(parsedMessage);
|
|
258
259
|
logger.info('rabbit: trying to consume', { queue, shouldConsume, msg });
|
|
259
260
|
if (!shouldConsume) {
|
|
@@ -284,7 +285,7 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
284
285
|
queue,
|
|
285
286
|
async (msg: any) => {
|
|
286
287
|
const parsedMessage = RabbitMq.parseMsg(msg);
|
|
287
|
-
|
|
288
|
+
newTrace(traceTypes.RABBIT);
|
|
288
289
|
const shouldConsume = await this.shouldConsumeMessageByTimestamp(parsedMessage);
|
|
289
290
|
logger.info('rabbit: trying to consume', { queue, shouldConsume, msg });
|
|
290
291
|
if (!shouldConsume) {
|
package/.env
DELETED
|
File without changes
|
package/dump.rdb
DELETED
|
Binary file
|