@autofleet/rabbit 2.1.8-beta4 → 2.1.8-beta6
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 +6 -1
- package/package.json +2 -2
- package/src/index.ts +9 -1
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<import("amqplib").Replies.AssertQueue>;
|
|
54
|
+
bindQueue(queue: string, exchange: string): Promise<void>;
|
|
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<boolean>;
|
|
60
60
|
isConnected(): Promise<boolean>;
|
|
61
61
|
}
|
|
62
62
|
export default RabbitMq;
|
package/dist/index.js
CHANGED
|
@@ -229,7 +229,12 @@ class RabbitMq {
|
|
|
229
229
|
if (!shouldConsume) {
|
|
230
230
|
return this.ack(channel)(msg);
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
try {
|
|
233
|
+
yield callback(parsedMessage, this.ack(channel, true), this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl }));
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
yield this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl });
|
|
237
|
+
}
|
|
233
238
|
})),
|
|
234
239
|
]);
|
|
235
240
|
}));
|
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-beta6",
|
|
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.7.0",
|
|
23
23
|
"amqplib": "^0.6.0",
|
|
24
24
|
"bluebird": "^3.7.2",
|
|
25
25
|
"moment": "^2.29.1",
|
package/src/index.ts
CHANGED
|
@@ -259,7 +259,15 @@ class RabbitMq implements IAfRabbitMq {
|
|
|
259
259
|
if (!shouldConsume) {
|
|
260
260
|
return this.ack(channel)(msg);
|
|
261
261
|
}
|
|
262
|
-
|
|
262
|
+
try {
|
|
263
|
+
await callback(
|
|
264
|
+
parsedMessage,
|
|
265
|
+
this.ack(channel, true),
|
|
266
|
+
this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl }),
|
|
267
|
+
);
|
|
268
|
+
} catch (e) {
|
|
269
|
+
await this.nack(channel, queue, optionsWithDefaults, { messageTtl: deadMessageTtl });
|
|
270
|
+
}
|
|
263
271
|
},
|
|
264
272
|
),
|
|
265
273
|
]);
|