Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Message delivery tracking

Hi,  when publishing a message using the synchronous MqttClient api and if an exception is thrown while publishing, is it possible to figure out if the message flow will be resumed when the client is reconnected to broker based on the thrown exception ? 

The question may sound a little strange, but I have a hard time figuring out if an exception occurs, should the message be republished again using the MqttClient.publish method or the mqtt library will take care republishing it ?

I have looked at the code of the library for exceptions with  reason codes that will lead to the message being removed from the mqtt token store  and not being resend again after reconnect. Here is what I found so far:


REASON_CODE_CLIENT_NOT_CONNECTED - mqtt will not resume delivery on reconnect

REASON_CODE_TOKEN_INUSE - mqtt will not resume delivery on reconnect
    
MqttPersistenceException while trying to persist the message - mqtt will not resume delivery on reconnect

REASON_CODE_CLIENT_DISCONNECTING - mqtt will not resume delivery on reconnect

REASON_CODE_CLIENT_TIMEOUT - message flow will be resumed when we reconnect

I know that there is a callback for delivery complete but if I depend only on that, how can I be sure if its going to be called when client reconnects after exception is thrown while trying to publishing a message ?



Back to the top