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
handle, const char *destinationName, const MQTTAsync_message
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.