HomePhabricator
Diffusion Comm 897ef7393abc

[Tunnelbroker] publish messages from DDB to RabbitMQ when client connects

Description

[Tunnelbroker] publish messages from DDB to RabbitMQ when client connects

Summary:
This code enqueues messages in RabbitMQ, instead of directly flushing to the client.

Why we need this:

  1. 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.
  2. This allows us to maintain the proper order of messages - messages from DDB that have higher priority are delivered first.
  3. 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

Test Plan:

  1. Run tests Tunnelbroker tests (most important are tunnelbroker_persist_tests and test_messages_order )
  2. Make sure priority works, do the following:
    • declare queue
    • send messages A, and B with priority 10
    • send message C with priority 1
    • send message D with priority 10
    • create consumer
    • consume messages - the order should be A, B, D, C

Reviewers: michal, bartek, varun, jon

Reviewed By: bartek

Subscribers: ashoat, tomek, wyilio

Differential Revision: https://phab.comm.dev/D9571

Details

Provenance
kamilAuthored on Oct 23 2023, 5:11 AM
Reviewer
bartek
Differential Revision
D9571: [Tunnelbroker] publish messages from DDB to RabbitMQ when client connects
Parents
rCOMM00bd2ffb66b0: [Tunnelbroker] fix messages order
Branches
Unknown
Tags
Unknown