Refactor http calls to support message payloads #646
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To enable client retries, the http calls now operates directly on message payloads instead of relying solely on
io.Writer
s. This refactor replaces write operations with send operations at message boundaries. It introduces a new interface,messagePayload
, implemented by*bytes.Reader
s and*envelopes
, enabling them to adopt sender operations.Changes Made:
messagePayload
, implemented by*bytes.Reader
and*envelope
, allowing for adoption of sender operations.messageSender
, implemented by*duplexHTTPCall
, which acts onmessagePayloads
to send the message.writeSender
forhttp.ResponseWriter
to implementmessageSender
via converting send payloads to write operations.Objective:
The goal of this refactor is to facilitate client retries by directly manipulating message payloads rather than relying solely on
io.Writer
s. ThemessagePayload
interface is a readable, seekable and sized payload which allows it to be replayed.This PR is part of the fix for #609 . It implements the groundwork for the handling of message payloads.