@nomikos/module-comm 1.0.11 → 1.0.13
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/services/AmqpReceiver.js +25 -19
package/package.json
CHANGED
|
@@ -29,29 +29,35 @@ module.exports = {
|
|
|
29
29
|
const options = cola.options;
|
|
30
30
|
const prefetch = cola.prefetch || 1;
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
try {
|
|
33
|
+
// Uso correcto de promesas sin envolver en una nueva promesa innecesariamente
|
|
34
|
+
await ch.assertQueue(queueName, options);
|
|
35
|
+
if (
|
|
36
|
+
options.arguments &&
|
|
37
|
+
options.arguments["x-dead-letter-routing-key"] &&
|
|
38
|
+
options.arguments["x-dead-letter-exchange"]
|
|
39
|
+
) {
|
|
40
|
+
const rk = options.arguments["x-dead-letter-routing-key"];
|
|
41
|
+
const exc = options.arguments["x-dead-letter-exchange"];
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
loggerRoot.debug(`Creando dead exchange: ${exc}.dl`);
|
|
44
|
+
await ch.assertExchange(exc, "direct", { durable: true });
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
loggerRoot.debug(`Creando dead letter: ${queueName}.dl`);
|
|
47
|
+
await ch.assertQueue(`${queueName}.dl`, { durable: true });
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
loggerRoot.debug(`Binding dead letter: ${queueName}.dl`);
|
|
50
|
+
await ch.bindQueue(`${queueName}.dl`, exc, rk);
|
|
51
|
+
}
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
ch.prefetch(prefetch);
|
|
54
|
+
amqpReceiverAdapter(ch, queueName, cola);
|
|
55
|
+
loggerRoot.debug(`COLA CONSUMO ${queueName}`);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
loggerRoot.error(
|
|
58
|
+
`Error al configurar las colas: ${error.message}`
|
|
59
|
+
);
|
|
60
|
+
}
|
|
55
61
|
})
|
|
56
62
|
); // end Promise.all
|
|
57
63
|
},
|