@inteli.city/node-red-contrib-rabbit-mq 1.0.0 → 1.0.1
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/README.md +2 -2
- package/mq.consumer.html +2 -2
- package/mq.consumer.js +7 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Connects to a RabbitMQ queue and emits one message per delivery.
|
|
|
46
46
|
| User / Password | AMQP credentials |
|
|
47
47
|
| Queue | Queue name (asserted as durable on connect) |
|
|
48
48
|
| Prefetch | Maximum number of unacknowledged messages at once |
|
|
49
|
-
| Timeout (min) | Maximum time before automatic nack. `0` uses the
|
|
49
|
+
| Timeout (min) | Maximum time before automatic nack. `0` uses the default of 120 minutes (2 hours). Any positive value is used as-is |
|
|
50
50
|
| SSL/TLS | Use `amqps://` — required for cloud brokers |
|
|
51
51
|
| Debug mode | Enables verbose logs |
|
|
52
52
|
|
|
@@ -233,7 +233,7 @@ Configure `mq.producer`:
|
|
|
233
233
|
Configure `mq.consumer`:
|
|
234
234
|
- Queue: `X.Teste`
|
|
235
235
|
- Prefetch: `1`
|
|
236
|
-
- Timeout: `0` (uses the
|
|
236
|
+
- Timeout: `0` (uses the 2-hour default)
|
|
237
237
|
- SSL: enabled
|
|
238
238
|
|
|
239
239
|
The `debug` node displays `msg.payload`. The `mq.ackw` confirms to the broker. Without `mq.ackw` at the end, the consumer will stall after the first message (prefetch=1).
|
package/mq.consumer.html
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</div>
|
|
27
27
|
<div class="form-row">
|
|
28
28
|
<label for="node-input-timeout"><i class="fa fa-clock-o"></i> Timeout (min)</label>
|
|
29
|
-
<input type="number" id="node-input-timeout" min="0" step="0.1" placeholder="0 =
|
|
29
|
+
<input type="number" id="node-input-timeout" min="0" step="0.1" placeholder="0 = default (120 min)" style="width:140px">
|
|
30
30
|
</div>
|
|
31
31
|
<div class="form-row">
|
|
32
32
|
<label for="node-input-ssl"><i class="fa fa-shield"></i> SSL/TLS</label>
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
<dt>Prefetch</dt>
|
|
55
55
|
<dd>Maximum number of unacknowledged messages delivered to this consumer at once.</dd>
|
|
56
56
|
<dt>Timeout (min)</dt>
|
|
57
|
-
<dd>
|
|
57
|
+
<dd>Maximum time before automatic nack and requeue. Set to 0 to use the default of 120 minutes (2 hours). Any positive value is used as-is in minutes.</dd>
|
|
58
58
|
<dt>SSL/TLS</dt>
|
|
59
59
|
<dd>Enable to use <code>amqps://</code> (TLS-secured connection). Disable only for local or non-secure RabbitMQ instances.</dd>
|
|
60
60
|
</dl>
|
package/mq.consumer.js
CHANGED
|
@@ -4,11 +4,10 @@ module.exports = function (RED) {
|
|
|
4
4
|
const amqp = require('amqplib');
|
|
5
5
|
const inflight = require('./mq.store');
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const FLOW_CHECK_DELAY = 10 * 1000; // warn after 10 s if still unacked
|
|
7
|
+
// Default timeout used when the user sets timeout = 0 (i.e. "use default").
|
|
8
|
+
// Any positive value configured by the user is used as-is, with no clamping.
|
|
9
|
+
const DEFAULT_TIMEOUT_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
10
|
+
const FLOW_CHECK_DELAY = 10 * 1000; // warn after 10 s if still unacked
|
|
12
11
|
|
|
13
12
|
function MQConsumerNode(config) {
|
|
14
13
|
RED.nodes.createNode(this, config);
|
|
@@ -18,10 +17,10 @@ module.exports = function (RED) {
|
|
|
18
17
|
const queue = config.queue;
|
|
19
18
|
const prefetch = parseInt(config.prefetch, 10) || 1;
|
|
20
19
|
|
|
21
|
-
//
|
|
22
|
-
//
|
|
20
|
+
// timeout = 0 → use the 2-hour default.
|
|
21
|
+
// timeout > 0 → use exactly the configured value (no clamping).
|
|
23
22
|
const configuredMs = (parseFloat(config.timeout) || 0) * 60 * 1000;
|
|
24
|
-
const timeoutMs = configuredMs > 0 ? configuredMs :
|
|
23
|
+
const timeoutMs = configuredMs > 0 ? configuredMs : DEFAULT_TIMEOUT_MS;
|
|
25
24
|
|
|
26
25
|
const debug = config.debug === true || config.debug === 'true';
|
|
27
26
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inteli.city/node-red-contrib-rabbit-mq",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Node-RED nodes for producing, consuming and acknowledging RabbitMQ messages",
|
|
5
5
|
"keywords": ["node-red", "rabbitmq", "amqp"],
|
|
6
6
|
"license": "Apache-2.0",
|