@onlineapps/conn-infra-mq 1.1.25 → 1.1.27
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
|
@@ -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.
|
|
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.
|
|
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
|
|
@@ -199,6 +201,9 @@ class RabbitMQClient extends EventEmitter {
|
|
|
199
201
|
const prefetch = options.prefetch !== undefined ? options.prefetch : this._config.prefetch;
|
|
200
202
|
const noAck = options.noAck !== undefined ? options.noAck : this._config.noAck;
|
|
201
203
|
|
|
204
|
+
console.log(`[RabbitMQClient] DEBUG: consume() called for queue: ${queue}`);
|
|
205
|
+
console.log(`[RabbitMQClient] DEBUG: Channel state: _channel closed=${this._channel ? this._channel.closed : 'N/A'}, _queueChannel closed=${this._queueChannel ? this._queueChannel.closed : 'N/A'}`);
|
|
206
|
+
|
|
202
207
|
try {
|
|
203
208
|
// Skip assertQueue for reply queues (they're already created with specific settings)
|
|
204
209
|
// Reply queues start with 'rpc.reply.' and are created as non-durable
|
|
@@ -210,10 +215,13 @@ class RabbitMQClient extends EventEmitter {
|
|
|
210
215
|
// Infrastructure queue - should already exist, created by infrastructure initialization
|
|
211
216
|
// Use queueChannel (regular channel) for queue operations to avoid RPC reply queue issues
|
|
212
217
|
// Only check if it exists, don't try to create or assert with arguments
|
|
218
|
+
console.log(`[RabbitMQClient] DEBUG: Infrastructure queue ${queue}, checking existence...`);
|
|
213
219
|
try {
|
|
214
220
|
await this._queueChannel.checkQueue(queue);
|
|
221
|
+
console.log(`[RabbitMQClient] DEBUG: Infrastructure queue ${queue} exists`);
|
|
215
222
|
// Queue exists - proceed to consume
|
|
216
223
|
} catch (checkErr) {
|
|
224
|
+
console.error(`[RabbitMQClient] DEBUG: checkQueue failed for infrastructure queue ${queue}:`, checkErr.message);
|
|
217
225
|
if (checkErr.code === 404) {
|
|
218
226
|
// Queue doesn't exist - infrastructure problem
|
|
219
227
|
throw new Error(`Infrastructure queue '${queue}' not found. Queue should be created during infrastructure initialization.`);
|
|
@@ -227,6 +235,7 @@ class RabbitMQClient extends EventEmitter {
|
|
|
227
235
|
// If queue doesn't exist, that's a programming error (setupServiceQueues() should have created it)
|
|
228
236
|
// Just proceed to consume - if queue doesn't exist, consume will fail with a clear error
|
|
229
237
|
// This avoids channel closure from checkQueue() on non-existent queues
|
|
238
|
+
console.log(`[RabbitMQClient] DEBUG: Business queue ${queue}, skipping checkQueue() - queue should already exist`);
|
|
230
239
|
}
|
|
231
240
|
}
|
|
232
241
|
// Set prefetch if provided
|