@onlineapps/conn-infra-mq 1.1.25 → 1.1.26

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.25",
3
+ "version": "1.1.26",
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": {
@@ -298,15 +298,26 @@ class QueueManager {
298
298
  try {
299
299
  // Check if channel is still open before each operation
300
300
  if (!channel || channel.closed) {
301
+ console.error(`[QueueManager] DEBUG: Channel closed before creating ${queueName}`);
301
302
  throw new Error(`Channel closed before creating ${queueName} - cannot continue`);
302
303
  }
303
304
 
305
+ console.log(`[QueueManager] DEBUG: About to assertQueue ${queueName} with options:`, JSON.stringify(queueOptions, null, 2));
306
+ console.log(`[QueueManager] DEBUG: Channel state before assertQueue: closed=${channel.closed}`);
307
+
304
308
  await channel.assertQueue(queueName, queueOptions);
309
+
310
+ console.log(`[QueueManager] DEBUG: assertQueue succeeded for ${queueName}, channel closed=${channel.closed}`);
305
311
  queues[queueInfo.type] = queueName;
306
312
  console.info(`[QueueManager] ✓ Created business queue: ${queueName}`);
307
313
  } catch (assertErr) {
314
+ console.error(`[QueueManager] DEBUG: assertQueue failed for ${queueName}:`, assertErr.message);
315
+ console.error(`[QueueManager] DEBUG: Error code: ${assertErr.code}, channel closed: ${channel ? channel.closed : 'N/A'}`);
316
+ console.error(`[QueueManager] DEBUG: Stack trace:`, assertErr.stack);
317
+
308
318
  // If channel closed, this is a critical error
309
319
  if (!channel || channel.closed) {
320
+ console.error(`[QueueManager] DEBUG: Channel was closed during assertQueue for ${queueName}`);
310
321
  throw new Error(`Channel closed during assertQueue for ${queueName} - cannot create remaining queues`);
311
322
  }
312
323
 
@@ -80,10 +80,12 @@ class RabbitMQClient extends EventEmitter {
80
80
  this._queueChannel = await this._connection.createChannel();
81
81
  this._queueChannel.on('error', (err) => {
82
82
  // Log but don't emit - queue channel errors are less critical
83
- console.warn('[RabbitMQClient] Queue channel error:', err.message);
83
+ console.error('[RabbitMQClient] Queue channel error:', err.message);
84
+ console.error('[RabbitMQClient] Stack trace:', new Error().stack);
84
85
  });
85
86
  this._queueChannel.on('close', () => {
86
- console.warn('[RabbitMQClient] Queue channel closed');
87
+ console.error('[RabbitMQClient] Queue channel closed');
88
+ console.error('[RabbitMQClient] Stack trace at close:', new Error().stack);
87
89
  });
88
90
  } catch (err) {
89
91
  // Cleanup partially created resources