@tiledesk/tiledesk-server 2.4.14 → 2.4.16
Sign up to get free protection for your applications and to get access to all the features.
package/package.json
CHANGED
@@ -15,6 +15,20 @@ var url = process.env.CLOUDAMQP_URL + "?heartbeat=60" || "amqp://localhost";
|
|
15
15
|
// attento devi aggiornare configMap di PRE E PROD
|
16
16
|
// var url = process.env.AMQP_URL + "?heartbeat=60" || "amqp://localhost?heartbeat=60";
|
17
17
|
|
18
|
+
var durable = false;
|
19
|
+
if (process.env.ENABLE_DURABLE_QUEUE == true || process.env.ENABLE_DURABLE_QUEUE == "true") {
|
20
|
+
durable = true;
|
21
|
+
}
|
22
|
+
winston.info("Durable queue: " + durable);
|
23
|
+
|
24
|
+
var persistent = false;
|
25
|
+
if (process.env.ENABLE_PERSISTENT_QUEUE == true || process.env.ENABLE_PERSISTENT_QUEUE == "true") {
|
26
|
+
persistent = true;
|
27
|
+
}
|
28
|
+
winston.info("Persistent queue: " + persistent);
|
29
|
+
|
30
|
+
|
31
|
+
|
18
32
|
var exchange = 'amq.topic';
|
19
33
|
|
20
34
|
function start() {
|
@@ -83,7 +97,9 @@ function startPublisher() {
|
|
83
97
|
// method to publish a message, will queue messages internally if the connection is down and resend later
|
84
98
|
function publish(exchange, routingKey, content) {
|
85
99
|
try {
|
86
|
-
pubChannel.publish(exchange, routingKey, content, { persistent:
|
100
|
+
pubChannel.publish(exchange, routingKey, content, { persistent: persistent },
|
101
|
+
// pubChannel.publish(exchange, routingKey, content, { persistent: true },
|
102
|
+
|
87
103
|
function(err, ok) {
|
88
104
|
if (err) {
|
89
105
|
winston.error("[AMQP] publish", err);
|
@@ -110,9 +126,12 @@ function startWorker() {
|
|
110
126
|
});
|
111
127
|
ch.prefetch(10);//leggila da env
|
112
128
|
ch.assertExchange(exchange, 'topic', {
|
113
|
-
durable:
|
129
|
+
durable: durable
|
130
|
+
// durable: true
|
114
131
|
});
|
115
|
-
|
132
|
+
|
133
|
+
ch.assertQueue("jobs", { durable: durable }, function(err, _ok) {
|
134
|
+
// ch.assertQueue("jobs", { durable: true }, function(err, _ok) {
|
116
135
|
if (closeOnErr(err)) return;
|
117
136
|
ch.bindQueue(_ok.queue, exchange, "request_create", {}, function(err3, oka) {
|
118
137
|
winston.info("Queue bind: "+_ok.queue+ " err: "+err3+ " key: request_create");
|