@onlineapps/conn-infra-mq 1.1.29 → 1.1.30
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 +1 -1
- package/src/layers/QueueManager.js +48 -11
package/package.json
CHANGED
|
@@ -336,25 +336,62 @@ class QueueManager {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
// Setup DLQ exchange and bindings
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
339
|
+
console.log(`[QueueManager] DEBUG: Setting up DLQ exchange: ${this.config.dlxExchange}`);
|
|
340
|
+
console.log(`[QueueManager] DEBUG: Channel state before assertExchange: closed=${channel.closed}`);
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
await channel.assertExchange(this.config.dlxExchange, 'direct', {
|
|
344
|
+
durable: true
|
|
345
|
+
});
|
|
346
|
+
console.log(`[QueueManager] DEBUG: DLQ exchange asserted, channel closed=${channel.closed}`);
|
|
347
|
+
} catch (exErr) {
|
|
348
|
+
console.error(`[QueueManager] DEBUG: assertExchange failed:`, exErr.message);
|
|
349
|
+
if (!channel || channel.closed) {
|
|
350
|
+
throw new Error(`Channel closed during assertExchange for ${this.config.dlxExchange}`);
|
|
351
|
+
}
|
|
352
|
+
throw exErr;
|
|
353
|
+
}
|
|
342
354
|
|
|
343
355
|
// Bind DLQ
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
if (queues.workflow) {
|
|
356
|
+
console.log(`[QueueManager] DEBUG: Binding DLQ: ${queues.dlq} to ${this.config.dlxExchange}`);
|
|
357
|
+
console.log(`[QueueManager] DEBUG: Channel state before bindQueue: closed=${channel.closed}`);
|
|
358
|
+
|
|
359
|
+
try {
|
|
351
360
|
await channel.bindQueue(
|
|
352
361
|
queues.dlq,
|
|
353
362
|
this.config.dlxExchange,
|
|
354
|
-
`${serviceName}.
|
|
363
|
+
`${serviceName}.queue.dlq`
|
|
355
364
|
);
|
|
365
|
+
console.log(`[QueueManager] DEBUG: DLQ bound, channel closed=${channel.closed}`);
|
|
366
|
+
} catch (bindErr) {
|
|
367
|
+
console.error(`[QueueManager] DEBUG: bindQueue failed:`, bindErr.message);
|
|
368
|
+
if (!channel || channel.closed) {
|
|
369
|
+
throw new Error(`Channel closed during bindQueue for ${queues.dlq}`);
|
|
370
|
+
}
|
|
371
|
+
throw bindErr;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
if (queues.workflow) {
|
|
375
|
+
console.log(`[QueueManager] DEBUG: Binding workflow DLQ: ${queues.dlq} to ${this.config.dlxExchange}`);
|
|
376
|
+
console.log(`[QueueManager] DEBUG: Channel state before workflow bindQueue: closed=${channel.closed}`);
|
|
377
|
+
|
|
378
|
+
try {
|
|
379
|
+
await channel.bindQueue(
|
|
380
|
+
queues.dlq,
|
|
381
|
+
this.config.dlxExchange,
|
|
382
|
+
`${serviceName}.workflow.dlq`
|
|
383
|
+
);
|
|
384
|
+
console.log(`[QueueManager] DEBUG: Workflow DLQ bound, channel closed=${channel.closed}`);
|
|
385
|
+
} catch (bindErr) {
|
|
386
|
+
console.error(`[QueueManager] DEBUG: workflow bindQueue failed:`, bindErr.message);
|
|
387
|
+
if (!channel || channel.closed) {
|
|
388
|
+
throw new Error(`Channel closed during workflow bindQueue`);
|
|
389
|
+
}
|
|
390
|
+
throw bindErr;
|
|
391
|
+
}
|
|
356
392
|
}
|
|
357
393
|
|
|
394
|
+
console.log(`[QueueManager] DEBUG: setupServiceQueues completed successfully, channel closed=${channel.closed}`);
|
|
358
395
|
return queues;
|
|
359
396
|
}
|
|
360
397
|
|