Does Paho MQTT Asynchronous C Client Buffer Received Messages? #1381
-
Can someone help me with this question? It's not really clear from the documentation what happens if you block too long in the messageArrived callback. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The application shouldn't spend much time in any of the callbacks, including messageArrived. In general that means no blocking operations. There is a message queue for outbound messages, but not for those inbound. When the messageArrived callback is running, some of the internal client library operations will be blocked - for instance any other call to messageArrived. You can return 0 from the messageArrived callback, indicating a failure, and the callback will be reinvoked. But this is not very efficient, and is only intended for error situations. |
Beta Was this translation helpful? Give feedback.
The application shouldn't spend much time in any of the callbacks, including messageArrived. In general that means no blocking operations. There is a message queue for outbound messages, but not for those inbound. When the messageArrived callback is running, some of the internal client library operations will be blocked - for instance any other call to messageArrived.
You can return 0 from the messageArrived callback, indicating a failure, and the callback will be reinvoked. But this is not very efficient, and is only intended for error situations.