Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Retry on Publish Fail Python Library

I am using the python pah-mqtt 1.0 library with django.  I am using the on_publish() callback to verify that messages have been sent.  Occasionally I never receive the callback and assume the message failed to send, so I retry.  My retry always exhibits the same issue, preventing me have having a successful retry.  

The general structure of the code is,

Call the publish() function.  Create a new timer thread that waits 10 seconds and checks an array for mid number of the message just published.  When the on_publish() callback is called I save the mid number into an array, so that when the 10 second timer expires we can check for it, if it is there we know the message was sent OK, else it was not.  If at the expiration time of the 10 seconds the mid number is not in the array I can publish again.  This publish never seems to work.


Back to the top