node-red-contrib-mqttdb 0.1.1

MQTT Node with persistent message storage

npm install node-red-contrib-mqttdb

MQTT DB Nodes

The MQTT DB Nodes are a clone of the built in MQTT nodes modified to optionally persist messages in a lightweight local database in case of a lost connection, crash or Node-RED restart.

How it works

The mqtt client used by the node is configured to store incoming and outgoing messages using the NeDB database. Messages are stored in the mqttdb directory in the Node-RED directory. In there, for each broker configuration node, here is a directory containing incoming and outgoing message collections.

To enable persistent storage for input and output messages, click on the appropriate check boxes. You can change the compaction interval time to compact the internal database and remove deleted messages.

Database files for a connection are stored in the Node-RED directory under the mqttdb directory. These can be safely removed after stopping Node-RED to clear unsent messages. The database used is NeDB.

Known Issues

  1. When a broker connection node is configured to persist incoming messages, the messages can be corrupted. We recommend only configuring outgoing persistence for now.

  2. The NeDB database is similar to REDIS in that it maintains data in RAM and writes to a file in case it goes down. Since it is RAM based, I expect it can only run so long storing messages before it runs into trouble.

Node Info

Version: 0.1.1
Updated 7 months, 3 weeks ago
License: Apache-2.0
Rating: 4.0
(1 )

Downloads

0 in the last day
104 in the last week
163 in the last month

Nodes

  • mqttdb in
  • mqttdb out
  • mqttdb-broker

Keywords

  • node-red
  • mqtt

Maintainers

  • sensetecnic