This code enqueues messages in RabbitMQ, instead of directly flushing to the client.
Why we need this:
- In the next diffs I'll introduce code responsible for confirming message, the message is sent here, but confirmation is received here - handling third place, where we also need to confirm messages (directly from DDB) could complicate the code.
- This allows us to maintain the proper order of messages - messages from DDB that have higher priority are delivered first.
- This gracefully handles the case where different brokers send messages to the device while sending persisted messages, in the previous version of the code that case could change messages order.
Depends on D9570