@onlineapps/conn-infra-mq 1.1.13 → 1.1.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlineapps/conn-infra-mq",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "A promise-based, broker-agnostic client for sending and receiving messages via RabbitMQ",
5
5
  "main": "src/index.js",
6
6
  "repository": {
@@ -36,7 +36,9 @@ class QueueManager {
36
36
  if (!transport || !transport.channel) {
37
37
  throw new Error('MQ client not connected');
38
38
  }
39
- const channel = transport.channel;
39
+ // Use queueChannel for queue operations to avoid RPC reply queue issues
40
+ // queueChannel is a regular channel, not ConfirmChannel
41
+ const channel = transport.queueChannel || transport.channel;
40
42
 
41
43
  let queueOptions;
42
44
 
@@ -315,7 +317,8 @@ class QueueManager {
315
317
  if (!transport || !transport.channel) {
316
318
  throw new Error('MQ client not connected');
317
319
  }
318
- const channel = transport.channel;
320
+ // Use queueChannel for queue operations
321
+ const channel = transport.queueChannel || transport.channel;
319
322
 
320
323
  return channel.purgeQueue(queueName);
321
324
  }
@@ -329,7 +332,8 @@ class QueueManager {
329
332
  if (!transport || !transport.channel) {
330
333
  throw new Error('MQ client not connected');
331
334
  }
332
- const channel = transport.channel;
335
+ // Use queueChannel for queue operations
336
+ const channel = transport.queueChannel || transport.channel;
333
337
 
334
338
  const result = await channel.checkQueue(queueName);
335
339
  return {
@@ -57,13 +57,25 @@ class RabbitMQClient extends EventEmitter {
57
57
  this.emit('error', new Error('RabbitMQ connection closed unexpectedly'));
58
58
  });
59
59
 
60
- // Use ConfirmChannel to enable publisher confirms
60
+ // Use ConfirmChannel to enable publisher confirms for publish operations
61
+ // BUT: Create a separate regular channel for queue operations to avoid RPC reply queue issues
61
62
  this._channel = await this._connection.createConfirmChannel();
62
63
  this._channel.on('error', (err) => this.emit('error', err));
63
64
  this._channel.on('close', () => {
64
65
  // Emit a channel close error
65
66
  this.emit('error', new Error('RabbitMQ channel closed unexpectedly'));
66
67
  });
68
+
69
+ // Create a separate regular channel for queue operations (assertQueue, checkQueue)
70
+ // This avoids RPC reply queue issues with ConfirmChannel.assertQueue()
71
+ this._queueChannel = await this._connection.createChannel();
72
+ this._queueChannel.on('error', (err) => {
73
+ // Log but don't emit - queue channel errors are less critical
74
+ console.warn('[RabbitMQClient] Queue channel error:', err.message);
75
+ });
76
+ this._queueChannel.on('close', () => {
77
+ console.warn('[RabbitMQClient] Queue channel closed');
78
+ });
67
79
  } catch (err) {
68
80
  // Cleanup partially created resources
69
81
  if (this._connection) {