MQTT node with disconnection - Node-RED

Hi, I'm using the MQTT node to send data to a cloud server, the Node-Red server is installed in a Physical Device which is collecting data from a PLC. In the MQTT out node configuration I'm using QoS 1 and I noticed that when the internet is disconnected on the device that has the Node-Red server installed and then reconnected, the data that the PLC sent to Node Red during the time of the internet disconnection is now sent at once. So I'm guessing that the MQTT node has a Buffer or something to store this data to send it when the connection is available again.

So my question is: How big is this Buffer or how much data can be store here during that disconnection time? Is there any way that I can know that?.

Thanks.

Welcome to the forum? Did you try searching the forum first? There was a discussion about this just recently: Mqtt out node buffering. There's no exact answer there but it appears it will buffer messages until the memory runs out.

Actually IIRC from that thread - my conclusion was that Node-RED will give up eventually before running out of memory

The problem on that thread turned out to be a hardware issue, nothing to do with MQTT. I have not seen any evidence that it will buffer for ever till it runs out of memory, certainly not on QOS 1. When you say the data is sent all at once, is that multiple messages on a single topic or 1 message each on a number of topics?

Multiple messages on the same topic at the same time, so what do you mean is a hardware issue? that depends on how much free memory the device in which the node red is installed have?

I did not say your issue was a hardware related, I said the thread linked to turned out to be a hardware problem with that system.
How long is your network disconnecting for? If you look at the mqtt out node you will see that when the network is disconnected the nodes still shows connected for up to to a couple of minutes. Until that time has elapsed the node does not know whether the broker is slow to respond or whether the connection has failed, so it buffers messages. If the connection recovers before the mqtt node shows Disconnected then the buffered messages will be sent. If the network remains disconnected then the mqtt node will realise that it has failed and will show disconnected and will, I believe, discard the buffered messages and any new messages until the connection recovers. I think (but an not certain) the timeout time is under the control of the broker and you may be able to configure that in the broker.

Is that what you are seeing?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.