@autofleet/rabbit 2.1.13 → 2.1.14

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
@@ -56,7 +56,7 @@ declare class RabbitMq implements IAfRabbitMq {
56
56
  assertExchange(exchangeName: string, options?: any): Promise<any>;
57
57
  getQueueLength(queue: string): Promise<import("amqplib").Replies.AssertQueue>;
58
58
  bindQueue(queue: string, exchange: string): Promise<void>;
59
- assertQueue(queue: string, options?: Options.AssertQueue): Promise<any>;
59
+ assertQueue(queueName: string, options?: Options.AssertQueue): Promise<any>;
60
60
  consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any): Promise<void>;
61
61
  consumeFromExchange(queue: string, exchange: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any): Promise<void>;
62
62
  publish(exchange: string, content: any, customHeaders?: any): Promise<void>;
package/dist/index.js CHANGED
@@ -183,14 +183,16 @@ class RabbitMq {
183
183
  return channel.bindQueue(queue, exchange, '');
184
184
  });
185
185
  }
186
- assertQueue(queue, options) {
186
+ assertQueue(queueName, options) {
187
187
  return __awaiter(this, void 0, void 0, function* () {
188
- RabbitMq.validateName('queue', queue);
188
+ RabbitMq.validateName('queue', queueName);
189
189
  const channel = yield this.assertChannel();
190
- if (this.queues[queue]) {
191
- return this.queues[queue];
190
+ if (this.queues[queueName]) {
191
+ return this.queues[queueName];
192
192
  }
193
- return channel.assertQueue(queue, options);
193
+ const queue = yield channel.assertQueue(queueName, options);
194
+ this.queues[queueName] = queueName;
195
+ return queue;
194
196
  });
195
197
  }
196
198
  consume(queue, callback, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -237,13 +237,15 @@ class RabbitMq implements IAfRabbitMq {
237
237
  return channel.bindQueue(queue, exchange, '');
238
238
  }
239
239
 
240
- async assertQueue(queue: string, options?: Options.AssertQueue) {
241
- RabbitMq.validateName('queue', queue);
240
+ async assertQueue(queueName: string, options?: Options.AssertQueue) {
241
+ RabbitMq.validateName('queue', queueName);
242
242
  const channel: ChannelWrapper = await this.assertChannel();
243
- if (this.queues[queue]) {
244
- return this.queues[queue];
243
+ if (this.queues[queueName]) {
244
+ return this.queues[queueName];
245
245
  }
246
- return channel.assertQueue(queue, options);
246
+ const queue = await channel.assertQueue(queueName, options);
247
+ this.queues[queueName] = queueName;
248
+ return queue;
247
249
  }
248
250
 
249
251
  async consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {