Switch to desktop version  
MQTT - Create a messages buffer when connection to the broker is down - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Java (https://techforum.ewon.biz/forum-53.html)
+--- Thread: MQTT - Create a messages buffer when connection to the broker is down (/thread-1074.html)



MQTT - Create a messages buffer when connection to the broker is down - simon - 29-10-2019

Hi,

Some of you use MQTT connection to send Tag live values to different IOT platforms.

However, you may also want to buffer the messages in case the MQTT connection is down.

As of firmware 14, you now have the possibility to detect the MQTT disconnection from the BASIC and JAVA.

So, the idea here is to create a function that saves the messages when the connection is down and create another function that sends these messages when the connection is up again.

Here is the program
  MQTT_EWONSUPPORT_BUFFER.zip (Size: 14,79 KB / Downloads: 94) (based on the https://ewonsupport.biz/mqtt broker).
(!! This program only works with firmware 14 and > !!)

PS : Be careful that if you use a big buffer file (See BufferFilePathMaxSize variable), the Flexy could take some minutes to push all the messages back to the broker when the connection is up again.  During this time, no "live" messages will be pushed or stored.

Simon