@icstsa/node-red-contrib-ics-queue 1.0.3
A contributed Node-RED node, that queues undeliverable messages to file for later delivery.
node-red-contrib-ics-queue
A Node-RED node that queues undeliverable messages to a local SQLite file for later delivery.
If an outbound Node-RED node, such as an MQTT node, goes offline, subsequent messages are normally lost until the node reconnects. By wiring a Queue node ahead of the outbound node and feeding the outbound node's status messages into the Queue, undeliverable messages are instead stored in a local SQLite database. When the outbound node reconnects, the Queue forwards the stored messages in the order they were received, then resumes forwarding new messages directly.
Install
Run the following in your Node-RED user directory (typically ~/.node-red):
npm install @icstsa/node-red-contrib-ics-queue
Restart Node-RED after installation.
Usage
- Place a Queue node before the outbound node (e.g. an MQTT output node) so message flow passes through the Queue first.
- Wire the status output of the outbound node into the input of the Queue node. The Queue uses these status messages to detect when the downstream node is connected or disconnected.
Configuration
| Field | Description |
|---|---|
| Name | Optional label for the node in the editor. |
| Connected Status Matches | A substring or regular-expression pattern that, when matched against an incoming status message, marks the outbound node as connected. Leave empty to treat any status as connected unless a disconnected match is given. |
| Disconnected Status Matches | A substring or regular-expression pattern that, when matched, marks the outbound node as disconnected. |
| Path to SQLite DB file | Path to the SQLite database file used to store queued messages during a disconnected state. This file must not be shared between multiple queue nodes. |
Matching rules
- If only Connected Status Matches is set, any status that does not match is treated as disconnected.
- If only Disconnected Status Matches is set, any status that does not match is treated as connected.
- If both are set, any status that matches neither is ignored and the current connection state is left unchanged.
Examples
Example flows live in the examples directory. Import
examples/ics-queue-mqtt-example.json into the Node-RED editor (Menu → Import) to see a
working setup that buffers MQTT messages while the broker is offline.
The example wires an inject node through the Queue node to an MQTT output node, and feeds the MQTT node's status output back into the Queue so it can detect connection state changes. Update the broker configuration and the SQLite DB path before use.
License
GPL-3.0-or-later. See LICENSE.