Recommendation on handling publishTimeoutException
See original GitHub issueVisiting this issue I was hoping to find some guidance on how to handle a publishTimeoutException, perhaps a generalized exception wrapper like:
mqtt_publish(mqttClient, topic, msg, attempt_count = 0, attempt_threshold = 3):
'''Use mqtt to publish a message, if the connection fails then retry attempt_threshold times'''
if attempt_count < attempt_threshold:
try:
mqttClient.publish(topic, msg, 1)
except AWSIoTPythonSDK.exception.AWSIoTExceptions.publishTimeoutException as e:
attempt_count+=1
mqtt_publish(mqttClient, topic, msg, attempt_count)
else:
mqttClient.publish(topic, msg, 1)
I didn’t find a recommendation to that effect, plus it seems as though publishTimeoutException could have broader meaning than just, “Server connection timed out” for example by too large of a message (> 128 KB).
Would the above pseudocode be an acceptable way to generalize the exception handling, or is there more to the publishTimeoutException that ought be accounted for?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Publish and Subscribe Time out in my code while sample ...
Hi, Im created my own AWS client class that i am using in one of my python project. The sample project connect_device_package is...
Read more >AWSIoTPythonSDK publishTimeoutException - Stack Overflow
I want to publish back once i get a get a data from Subscribe topic. However when i do so, AWSIoTPythonSDK throws exception...
Read more >Omega2 aws connect error, SSL certificate verify failed
Hi everyone, I am working on project where i need to connect Omega2 to AWS Iot core. I had followed AWS Omega2 tutorial...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, still interested.
I have not implemented any particular code to handle the issue.
It seems that perhaps this function coupled with the offline queue could cause duplicate message delivery (without setting the dup flag) so I have not implemented this in case I want to filter duplicate messages on my broker side.
Really the question is still open considering handling the publishTimeoutException is such a broad error.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.