@onlineapps/conn-infra-mq 1.1.23 → 1.1.25
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
|
@@ -311,18 +311,12 @@ class QueueManager {
|
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
// If 406 PRECONDITION-FAILED, queue exists with different args - use it as-is
|
|
314
|
+
// CRITICAL: Do NOT use checkQueue() here - it closes channel on 404!
|
|
315
|
+
// If assertQueue() returned 406, queue exists (just with different args) - that's OK
|
|
314
316
|
if (assertErr.code === 406) {
|
|
315
317
|
console.warn(`[QueueManager] Queue ${queueName} exists with different arguments, using as-is:`, assertErr.message);
|
|
316
|
-
//
|
|
317
|
-
|
|
318
|
-
throw new Error(`Channel closed after 406 error for ${queueName}`);
|
|
319
|
-
}
|
|
320
|
-
try {
|
|
321
|
-
await channel.checkQueue(queueName);
|
|
322
|
-
queues[queueInfo.type] = queueName;
|
|
323
|
-
} catch (checkErr) {
|
|
324
|
-
throw new Error(`Failed to verify existing queue ${queueName}: ${checkErr.message}`);
|
|
325
|
-
}
|
|
318
|
+
// Queue exists (just with different args) - accept it
|
|
319
|
+
queues[queueInfo.type] = queueName;
|
|
326
320
|
} else {
|
|
327
321
|
// Other error - critical, cannot continue
|
|
328
322
|
throw new Error(`Failed to create business queue ${queueName}: ${assertErr.message}`);
|
|
@@ -223,25 +223,10 @@ class RabbitMQClient extends EventEmitter {
|
|
|
223
223
|
}
|
|
224
224
|
} else {
|
|
225
225
|
// Business queue - should already be created by setupServiceQueues() BEFORE consume is called
|
|
226
|
-
//
|
|
227
|
-
//
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
// Queue exists - proceed to consume
|
|
231
|
-
} catch (checkErr) {
|
|
232
|
-
if (checkErr.code === 404) {
|
|
233
|
-
// Queue doesn't exist - this is an error, queue should have been created by setupServiceQueues()
|
|
234
|
-
throw new Error(`Business queue '${queue}' not found. Queue should be created by setupServiceQueues() before consuming.`);
|
|
235
|
-
}
|
|
236
|
-
// Other error (including 406) - queue exists with different args, use it as-is
|
|
237
|
-
if (checkErr.code === 406) {
|
|
238
|
-
console.warn(`[RabbitMQClient] Queue ${queue} exists with different arguments, using as-is:`, checkErr.message);
|
|
239
|
-
// Proceed to consume - queue exists, just with different args
|
|
240
|
-
} else {
|
|
241
|
-
// Other error - rethrow
|
|
242
|
-
throw checkErr;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
226
|
+
// CRITICAL: Do NOT use checkQueue() - it closes channel on 404!
|
|
227
|
+
// If queue doesn't exist, that's a programming error (setupServiceQueues() should have created it)
|
|
228
|
+
// Just proceed to consume - if queue doesn't exist, consume will fail with a clear error
|
|
229
|
+
// This avoids channel closure from checkQueue() on non-existent queues
|
|
245
230
|
}
|
|
246
231
|
}
|
|
247
232
|
// Set prefetch if provided
|