@onlineapps/mq-client-core 1.0.80 → 1.0.81
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
|
@@ -249,6 +249,7 @@ module.exports = {
|
|
|
249
249
|
monitoring: {
|
|
250
250
|
/**
|
|
251
251
|
* monitoring.workflow - Unified workflow lifecycle monitoring
|
|
252
|
+
* Bound to monitoring.workflow.fanout exchange (fanout).
|
|
252
253
|
* Delivery Dispatcher publishes 'completed'/'failed' events after processing workflow.completed/workflow.failed
|
|
253
254
|
* Business services publish 'progress' events during workflow step processing
|
|
254
255
|
* Message format includes event_type: 'completed' | 'failed' | 'progress'
|
|
@@ -277,6 +278,73 @@ module.exports = {
|
|
|
277
278
|
'x-message-ttl': 600000, // 10 minutes TTL (longer for service tracking)
|
|
278
279
|
'x-max-length': 20000
|
|
279
280
|
}
|
|
281
|
+
},
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* monitoring.workflow.fanout - Fanout exchange for workflow events
|
|
285
|
+
* Publishers send to this exchange; monitoring.workflow + delivery.workflow.events both receive copies.
|
|
286
|
+
*/
|
|
287
|
+
'workflow.fanout': {
|
|
288
|
+
type: 'exchange',
|
|
289
|
+
exchangeType: 'fanout',
|
|
290
|
+
durable: true
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Delivery endpoint event queue configurations
|
|
296
|
+
* These are queues consumed by api_delivery_endpoint for real-time WS push.
|
|
297
|
+
*/
|
|
298
|
+
deliveryEvents: {
|
|
299
|
+
/**
|
|
300
|
+
* delivery.workflow.events - Workflow progress events for WS clients
|
|
301
|
+
* Bound to monitoring.workflow.fanout exchange.
|
|
302
|
+
*/
|
|
303
|
+
'workflow.events': {
|
|
304
|
+
durable: true,
|
|
305
|
+
arguments: {
|
|
306
|
+
'x-message-ttl': 60000, // 60s TTL - real-time events, stale ones are useless
|
|
307
|
+
'x-max-length': 10000
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* delivery.health.events - Infrastructure health events for WS clients
|
|
313
|
+
* Bound to infrastructure.health.events exchange.
|
|
314
|
+
*/
|
|
315
|
+
'health.events': {
|
|
316
|
+
durable: true,
|
|
317
|
+
arguments: {
|
|
318
|
+
'x-message-ttl': 60000,
|
|
319
|
+
'x-max-length': 5000
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* delivery.alert.events - Alert events for WS clients
|
|
325
|
+
* Bound to alert.events.fanout exchange.
|
|
326
|
+
*/
|
|
327
|
+
'alert.events': {
|
|
328
|
+
durable: true,
|
|
329
|
+
arguments: {
|
|
330
|
+
'x-message-ttl': 300000, // 5 minutes - alerts are more important
|
|
331
|
+
'x-max-length': 5000
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
},
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Alert exchange configuration
|
|
338
|
+
*/
|
|
339
|
+
alerts: {
|
|
340
|
+
/**
|
|
341
|
+
* alert.events.fanout - Fanout exchange for alert events
|
|
342
|
+
* Monitoring watchdogs publish alerts here; delivery.alert.events consumes copies.
|
|
343
|
+
*/
|
|
344
|
+
'events.fanout': {
|
|
345
|
+
type: 'exchange',
|
|
346
|
+
exchangeType: 'fanout',
|
|
347
|
+
durable: true
|
|
280
348
|
}
|
|
281
349
|
},
|
|
282
350
|
|
|
@@ -103,7 +103,11 @@ async function publishToMonitoringResilient(mqClient, queueName, message, logger
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
try {
|
|
106
|
-
|
|
106
|
+
const WORKFLOW_FANOUT = 'monitoring.workflow.fanout';
|
|
107
|
+
const publishOptions = queueName === 'monitoring.workflow'
|
|
108
|
+
? { exchange: WORKFLOW_FANOUT, exchangeType: 'fanout', routingKey: '' }
|
|
109
|
+
: {};
|
|
110
|
+
await mqClient.publish(queueName, message, publishOptions);
|
|
107
111
|
|
|
108
112
|
if (logger && logger.debug) {
|
|
109
113
|
logger.debug(`Published to ${queueName}`, {
|
|
@@ -1258,7 +1258,8 @@ class RabbitMQClient extends EventEmitter {
|
|
|
1258
1258
|
// Track operation for debugging
|
|
1259
1259
|
this._trackChannelOperation(this._channel, `publish to ${queue}`);
|
|
1260
1260
|
|
|
1261
|
-
const exchange = this._config.exchange || '';
|
|
1261
|
+
const exchange = options.exchange || this._config.exchange || '';
|
|
1262
|
+
const exchangeType = options.exchangeType || 'direct';
|
|
1262
1263
|
const routingKey = options.routingKey || queue;
|
|
1263
1264
|
const persistent = options.persistent !== undefined ? options.persistent : this._config.durable;
|
|
1264
1265
|
const headers = options.headers || {};
|
|
@@ -1473,7 +1474,7 @@ class RabbitMQClient extends EventEmitter {
|
|
|
1473
1474
|
} else {
|
|
1474
1475
|
// If exchange is specified, assert exchange and publish to it
|
|
1475
1476
|
// Channel is guaranteed to be open (ensured above)
|
|
1476
|
-
await this._channel.assertExchange(exchange,
|
|
1477
|
+
await this._channel.assertExchange(exchange, exchangeType, { durable: this._config.durable });
|
|
1477
1478
|
|
|
1478
1479
|
// Use callback-based confirmation - kanály jsou spolehlivé
|
|
1479
1480
|
const confirmPromise = new Promise((resolve, reject) => {
|