Assuming I have topic A and topic B.
Upon starting my application, inside on_connect
, I am subscribing to both topics with QOS 2. Then I start the thread with loop_forever()
.
Now, lets assume I have missed messages on topic B which were sent while I was gone and I have retained messages on topic A.
Upon subscribing, which messages will be processed first?
- Is it defined due to the type (i.e. persistent session messages and retained messages on a topic)?
- Or is the subscription order in
on_connect
decisive? (which I would not assume as the thread starts checking them uponloop_forever()
only and the order might not be presumed) - Or is it random?
From my tests, it seems the missed messages I get due to the persistent session from topic B will be processed first.
Can I rely on that behaviour?
PS: As hardillb mentioned that behaviour might be broker specific. I am using Mosquitto.