Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Query regarding Offline Message buffering in Paho Mqtt C Client


I am using Paho Mqtt C Client.Main purpose is to send some data to the server.I want to save the data to some database if the sendMessage function fails to publish it due to internet connectivity.

Below api is being called to publish data to the cloud and i have enabled the auto-reconnect option.

 MQTTAsync_sendMessage (MQTTAsync handle, const char *destinationName, const MQTTAsync_message *msg, MQTTAsync_responseOptions *response)

Now suppose the application is running and connected to the server ,i just unplugged the ethernet cable and at the same time the MQTTAsync_sendMessage api is called to publish data.For this small time period the connection state remains connected and the data will be saved in some buffer. If the internet is connected before the application starts reconnecting to the server due to auto-reconnect, sendMessage will be able to successfully publish the data.If the application starts reconnecting and connects successfully after sometime then this buffer is getting lost and publish is not happening.

Can somebody help me with this issue?
Is there any way to save this buffer value?
Can we disable the offline buffering?

Back to the top