HomePhabricator
Diffusion Comm d35c221aae8c

[services] Tunnelbroker - Removing processed messages

Description

[services] Tunnelbroker - Removing processed messages

Summary:
This diff adds removing of processed messages by the client from the database and handling of the incoming processedMessages gRPC message.
When the Tunnelbroker sends messages to the client by MessagesToDeliver (in D5540, D5580) we are expecting messages IDs back from the client as ProcessedMessages when they are successfully processed. After receiving the messages IDs the Tunnelbroker will remove messages from the database. Using this mechanism we are sure that the messages were successfully processed by the client before removing them.

Linear task: ENG-2060

Test Plan:

  1. Insert a message into the messages table with the corresponding deviceID in the toDeviceID field.
  2. Connect by the gRPC client to the bidirectional stream with the sessionID corresponding to the deviceID in metadata.
  3. The message from the database would be delivered to the client as the MessagesToDeliver.
  4. Get the messageID identifier from the delivered message.
  5. Send back to the stream a processedMessages message with the message identifier.
  6. The expected result is that the message with the corresponding messageID will be removed from the database in messages table.

Reviewers: jon, varun, marcin, tomek

Reviewed By: jon, tomek

Subscribers: ashoat, tomek, atul, abosh

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

Details