@jsnw/nestjs-rabbitmq 2.0.3 → 2.0.5

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.
@@ -97,7 +97,11 @@ class Rabbitmq {
97
97
  queue: typeof queue === 'string' ? queue : queue.name,
98
98
  passive: true
99
99
  });
100
- return { messages: messageCount, consumers: consumerCount };
100
+ return {
101
+ name: typeof queue === 'string' ? queue : queue.name,
102
+ messages: messageCount,
103
+ consumers: consumerCount
104
+ };
101
105
  }
102
106
  catch (e) {
103
107
  return null;
@@ -175,9 +179,16 @@ class Rabbitmq {
175
179
  exchange: options.exchange.name,
176
180
  routingKey: options.routingKey,
177
181
  durable: options.durable !== undefined ? options.durable : options.exchange.durable,
178
- contentType: options.type === 'json' ? 'application/json' : undefined,
182
+ /*
183
+ As it turned out, rabbitmq-client's Envelope['contentType'] is not used anywhere,
184
+ the library sets contentType property based on the type of message body and completely
185
+ disregards contentType set in the Envelope
186
+
187
+ https://github.com/cody-greene/node-rabbitmq-client/blob/af2317717e2ef169717f2371ddf2c8bf2843ed37/src/Channel.ts#L501
188
+ */
189
+ // contentType: options.type === 'json' ? 'application/json' : undefined,
179
190
  expiration: options.ttlMs?.toString() ?? undefined
180
- }, options.type === 'json' ? JSON.stringify(options.message) : options.message);
191
+ }, options.message);
181
192
  }
182
193
  /**
183
194
  * @return {Promise<void>}
@@ -8,6 +8,7 @@ import { RabbitmqSubscriber } from './rabbitmq-subscriber';
8
8
  export type RabbitmqConstructorParams = ConnectionOptions & {};
9
9
  export type RabbitmqResponse = 'ack' | 'drop' | 'requeue';
10
10
  export type RabbitmqQueueStats = {
11
+ name: string;
11
12
  messages: number;
12
13
  consumers: number;
13
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsnw/nestjs-rabbitmq",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "NestJS module for RabbitMQ integration",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/types/index.d.ts",