Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Being notified of messages that fail to publish

Hi,

For QoS > 0, message will never "fail" to get published. Paho library will ensure that those message get published and received by the broker. QoS > 0 messages always get queue (in memory), are only removed when publish is successful (when on_publish is called) and are retried if not received (IIRC, after waiting the keepalive duration).

So if you only care about not losing message while the client is running, Paho library already does it.

If you need on disk persistent queue, then your usage of sqlite seems good. You do not need a timer to re-publish message (the in-memory queue of paho library will handle it), but only re-publish all messages from sqlite when your client restart.

Regards,

Pierre Fersing


Le 28/04/2017 à 07:48, Amr Bekhit a écrit :
Hello all,

I'm using the Paho Python MQTT client 1.2.0. As far as I can tell, the library provides the following mechanism for checking that a message has been transmitted successfully: first, the .publish method can return a success or error code to indicate whether or not the client is connected. After that, once the message has been transmitted successfully (the definition of success varying depending on the QoS), the on_publish callback is called.

However, I couldn't find any sort of mechanism that would allow me to detect if a message was successfully queued for publishing failed to get published. Does one exist? If not, any recommendations on how such a thing would be implemented? At the moment, I've got a transmit queue stored in an sqlite database. Once the message has been successfully passed to publish, I update the entry with the mid value, indicating that the message is currently queued for transmission. The on_publish callback is then responsible for removing the message from the database. I'm thinking that I would need to implement some sort of timer that regularly checks the database and resets any messages that have been passed to publish, but not been removed after a certain period of time.


_______________________________________________
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


Back to the top