Skip to main content

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

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.

Back to the top