@autofleet/rabbit 1.1.0 → 1.2.0
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 +4 -4
- package/package.json +1 -1
- package/src/index.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -85,9 +85,9 @@ class RabbitMq {
|
|
|
85
85
|
const { limit } = options ? options : 1;
|
|
86
86
|
const channel = await this.assertChannel();
|
|
87
87
|
await this.assertQueue(queue);
|
|
88
|
-
return channel.addSetup((c) => {
|
|
88
|
+
return channel.addSetup(async (c) => {
|
|
89
|
+
await c.prefetch(limit, true);
|
|
89
90
|
return Promise.all([
|
|
90
|
-
c.prefetch(limit, true),
|
|
91
91
|
c.consume(queue, (msg) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
|
|
92
92
|
]);
|
|
93
93
|
});
|
|
@@ -99,9 +99,9 @@ class RabbitMq {
|
|
|
99
99
|
this.assertExchange(exchange),
|
|
100
100
|
this.assertQueue(queue),
|
|
101
101
|
]);
|
|
102
|
-
return channel.addSetup((c) => {
|
|
102
|
+
return channel.addSetup(async (c) => {
|
|
103
|
+
await c.prefetch(limit, true);
|
|
103
104
|
return Promise.all([
|
|
104
|
-
c.prefetch(limit, true),
|
|
105
105
|
c.bindQueue(queue, exchange, ''),
|
|
106
106
|
c.consume(queue, (msg) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
|
|
107
107
|
]);
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -102,9 +102,9 @@ class RabbitMq {
|
|
|
102
102
|
const { limit } = options ? options : 1;
|
|
103
103
|
const channel: ChannelWrapper = await this.assertChannel();
|
|
104
104
|
await this.assertQueue(queue);
|
|
105
|
-
return channel.addSetup((c: ConfirmChannel) => {
|
|
105
|
+
return channel.addSetup(async (c: ConfirmChannel) => {
|
|
106
|
+
await c.prefetch(limit, true);
|
|
106
107
|
return Promise.all([
|
|
107
|
-
c.prefetch(limit, true),
|
|
108
108
|
c.consume(queue, (msg: any) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
|
|
109
109
|
]);
|
|
110
110
|
});
|
|
@@ -118,9 +118,9 @@ class RabbitMq {
|
|
|
118
118
|
this.assertQueue(queue),
|
|
119
119
|
]);
|
|
120
120
|
|
|
121
|
-
return channel.addSetup((c: ConfirmChannel) => {
|
|
121
|
+
return channel.addSetup(async (c: ConfirmChannel) => {
|
|
122
|
+
await c.prefetch(limit, true);
|
|
122
123
|
return Promise.all([
|
|
123
|
-
c.prefetch(limit, true),
|
|
124
124
|
c.bindQueue(queue, exchange, ''),
|
|
125
125
|
c.consume(queue, (msg: any) => callback(RabbitMq.parseMsg(msg), this.ack, this.nack(queue))),
|
|
126
126
|
])
|