Skip to main content

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

Hi,

ideally from a clean design point of view, if you get an exception on publish, the message must be retried.  We should try to attain that goal, if it isn't already.  Otherwise, writing an application is unnecessarily difficult.  

The most awkward case is where the first part of the exchange works (for QoS 1 or 2), but does not complete.   On reconnect this will be completed, unless we have connected cleansession.

However, the API doesn't have any other way of returning error information other than an exception.  An alternative would be to have some information in the exception that specified whether the exchange was going to be completed or not.

Ian


On 12/09/2014 06:08 PM, Рангел Иванов wrote:
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 ?




_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


Back to the top