Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(server): Submit envelopes directly from processor (#2936)
Removes circular roundtrips between the envelope processor service and the now obsolete envelope manager by encoding and submitting envelopes directly in the processor. Previously, `EnvelopeManager` was the service responsible to supervise the lifecycle of an envelope. This included dispatching it to the right backend (Kafka or HTTP upstream) and logging outcomes in the event of an error. However, in order to submit envelopes via HTTP, they conditionally need to be compressed, which was sent back to the envelope processor. The overall chain was therefore Processor -> manager -> processor -> manager -> upstream -> manager. Additionally, the manager had to maintain a long-running future to await the result of sending the envelope upstream. With this refactor, the envelope manager no longer exists. Instead, the processor directly encodes the envelope and submits a message to the correct backend. As a positive side-effect of this change, encoding of large envelopes no longer blocks the main runtime. If submission fails, either the request's `respond` method logs outcomes, or in case the message is lost `ManagedEnvelope::drop` does so. The public `SubmitEnvelope` message still exists and has moved to `EnvelopeProcessor`, which allows other services to send envelopes.
- Loading branch information