@onlineapps/mq-client-core 1.0.29 → 1.0.31
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
|
@@ -113,6 +113,72 @@ module.exports = {
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Delivery infrastructure queue configurations
|
|
118
|
+
* Managed by API Delivery Dispatcher
|
|
119
|
+
*/
|
|
120
|
+
delivery: {
|
|
121
|
+
/**
|
|
122
|
+
* delivery.retry - Retry queue for failed delivery attempts
|
|
123
|
+
* Used for delayed retries driven by Delivery Dispatcher
|
|
124
|
+
*/
|
|
125
|
+
retry: {
|
|
126
|
+
durable: true,
|
|
127
|
+
arguments: {
|
|
128
|
+
'x-max-length': 10000 // Allow up to 10k pending retry messages
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* delivery.result - Final delivery status events for audits/monitoring
|
|
134
|
+
*/
|
|
135
|
+
result: {
|
|
136
|
+
durable: true,
|
|
137
|
+
arguments: {
|
|
138
|
+
'x-message-ttl': 86400000, // 24 hours TTL for audit traceability
|
|
139
|
+
'x-max-length': 50000
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* delivery.websocket.notify - Notifications for Gateway websocket hub
|
|
145
|
+
*/
|
|
146
|
+
'websocket.notify': {
|
|
147
|
+
durable: true,
|
|
148
|
+
arguments: {
|
|
149
|
+
'x-message-ttl': 60000, // Notifications older than 60s are irrelevant
|
|
150
|
+
'x-max-length': 10000
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Validation infrastructure queue configurations
|
|
157
|
+
*/
|
|
158
|
+
validation: {
|
|
159
|
+
/**
|
|
160
|
+
* validation.requests - Requests from Registry to Validator
|
|
161
|
+
*/
|
|
162
|
+
requests: {
|
|
163
|
+
durable: true,
|
|
164
|
+
arguments: {
|
|
165
|
+
'x-message-ttl': 300000, // 5 minutes TTL to avoid stale requests
|
|
166
|
+
'x-max-length': 10000
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* validation.responses - Responses from Validator back to Registry
|
|
172
|
+
*/
|
|
173
|
+
responses: {
|
|
174
|
+
durable: true,
|
|
175
|
+
arguments: {
|
|
176
|
+
'x-message-ttl': 300000,
|
|
177
|
+
'x-max-length': 10000
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
|
|
116
182
|
/**
|
|
117
183
|
* Infrastructure health tracking queue configurations
|
|
118
184
|
*/
|
|
@@ -269,7 +335,34 @@ module.exports = {
|
|
|
269
335
|
queueName.startsWith('registry.') ||
|
|
270
336
|
queueName.startsWith('infrastructure.') ||
|
|
271
337
|
queueName.startsWith('validation.') ||
|
|
272
|
-
queueName.startsWith('monitoring.')
|
|
338
|
+
queueName.startsWith('monitoring.') ||
|
|
339
|
+
queueName.startsWith('delivery.');
|
|
340
|
+
},
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Get delivery queue configuration
|
|
344
|
+
* @param {string} queueName - Queue name (e.g., 'delivery.retry')
|
|
345
|
+
* @returns {Object} Queue configuration
|
|
346
|
+
*/
|
|
347
|
+
getDeliveryQueueConfig(queueName) {
|
|
348
|
+
if (!queueName.startsWith('delivery.')) {
|
|
349
|
+
throw new Error(`Queue ${queueName} is not a delivery queue`);
|
|
350
|
+
}
|
|
351
|
+
const name = queueName.replace('delivery.', '');
|
|
352
|
+
return this.getQueueConfig('delivery', name);
|
|
353
|
+
},
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Get validation queue configuration
|
|
357
|
+
* @param {string} queueName - Queue name (e.g., 'validation.requests')
|
|
358
|
+
* @returns {Object} Queue configuration
|
|
359
|
+
*/
|
|
360
|
+
getValidationQueueConfig(queueName) {
|
|
361
|
+
if (!queueName.startsWith('validation.')) {
|
|
362
|
+
throw new Error(`Queue ${queueName} is not a validation queue`);
|
|
363
|
+
}
|
|
364
|
+
const name = queueName.replace('validation.', '');
|
|
365
|
+
return this.getQueueConfig('validation', name);
|
|
273
366
|
},
|
|
274
367
|
|
|
275
368
|
/**
|
|
@@ -368,6 +461,10 @@ module.exports = {
|
|
|
368
461
|
return this.getInfrastructureHealthQueueConfig(queueName);
|
|
369
462
|
} else if (queueName.startsWith('monitoring.')) {
|
|
370
463
|
return this.getMonitoringQueueConfig(queueName);
|
|
464
|
+
} else if (queueName.startsWith('validation.')) {
|
|
465
|
+
return this.getValidationQueueConfig(queueName);
|
|
466
|
+
} else if (queueName.startsWith('delivery.')) {
|
|
467
|
+
return this.getDeliveryQueueConfig(queueName);
|
|
371
468
|
} else {
|
|
372
469
|
throw new Error(`Queue ${queueName} is not an infrastructure queue. Infrastructure queues must start with 'workflow.', 'registry.', 'infrastructure.', or 'monitoring.'`);
|
|
373
470
|
}
|
|
@@ -284,13 +284,12 @@ class RabbitMQClient extends EventEmitter {
|
|
|
284
284
|
if (!queue.startsWith('rpc.reply.')) {
|
|
285
285
|
// CRITICAL: Use queueConfig.js to get correct parameters (TTL, max-length, etc.)
|
|
286
286
|
// This prevents 406 PRECONDITION-FAILED errors from TTL mismatches
|
|
287
|
-
//
|
|
288
|
-
// Try to load it - if it fails, we'll use defaults
|
|
287
|
+
// Use local queueConfig from mq-client-core (it has infrastructure queue configs)
|
|
289
288
|
let queueConfig = null;
|
|
290
289
|
try {
|
|
291
|
-
queueConfig = require('
|
|
290
|
+
queueConfig = require('../config/queueConfig');
|
|
292
291
|
} catch (requireErr) {
|
|
293
|
-
console.warn(`[RabbitMQClient] [mq-client-core] [CONSUMER] Cannot load queueConfig
|
|
292
|
+
console.warn(`[RabbitMQClient] [mq-client-core] [CONSUMER] Cannot load queueConfig:`, requireErr.message);
|
|
294
293
|
console.warn(`[RabbitMQClient] [mq-client-core] [CONSUMER] Using default queue options (this may cause 406 errors if queue exists with different args)`);
|
|
295
294
|
}
|
|
296
295
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const queueConfig = require('../../src/config/queueConfig');
|
|
4
|
+
|
|
5
|
+
describe('queueConfig delivery infrastructure', () => {
|
|
6
|
+
test('delivery.retry configuration', () => {
|
|
7
|
+
const config = queueConfig.getInfrastructureQueueConfig('delivery.retry');
|
|
8
|
+
expect(config).toEqual({
|
|
9
|
+
durable: true,
|
|
10
|
+
arguments: {
|
|
11
|
+
'x-max-length': 10000
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('delivery.result configuration', () => {
|
|
17
|
+
const config = queueConfig.getInfrastructureQueueConfig('delivery.result');
|
|
18
|
+
expect(config).toEqual({
|
|
19
|
+
durable: true,
|
|
20
|
+
arguments: {
|
|
21
|
+
'x-message-ttl': 86400000,
|
|
22
|
+
'x-max-length': 50000
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('delivery.websocket.notify configuration', () => {
|
|
28
|
+
const config = queueConfig.getInfrastructureQueueConfig('delivery.websocket.notify');
|
|
29
|
+
expect(config).toEqual({
|
|
30
|
+
durable: true,
|
|
31
|
+
arguments: {
|
|
32
|
+
'x-message-ttl': 60000,
|
|
33
|
+
'x-max-length': 10000
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const queueConfig = require('../../src/config/queueConfig');
|
|
4
|
+
|
|
5
|
+
describe('queueConfig validation infrastructure', () => {
|
|
6
|
+
test('validation.requests configuration', () => {
|
|
7
|
+
const config = queueConfig.getInfrastructureQueueConfig('validation.requests');
|
|
8
|
+
expect(config).toEqual({
|
|
9
|
+
durable: true,
|
|
10
|
+
arguments: {
|
|
11
|
+
'x-message-ttl': 300000,
|
|
12
|
+
'x-max-length': 10000
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('validation.responses configuration', () => {
|
|
18
|
+
const config = queueConfig.getInfrastructureQueueConfig('validation.responses');
|
|
19
|
+
expect(config).toEqual({
|
|
20
|
+
durable: true,
|
|
21
|
+
arguments: {
|
|
22
|
+
'x-message-ttl': 300000,
|
|
23
|
+
'x-max-length': 10000
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|