Skip to content

Replace versioned delivery tags with a similar concept in the Java client #710

Open
@michaelklishin

Description

@michaelklishin
Member

Now that #700 is done, we can consider doing nothing or adopting a solution used by RecoveryAwareChannelN (N here means "non-zero", the zero channel has a special meaning in the protocol).

It keeps track of the highest seen delivery tag (and not an "epoch" or "term" tied to connection recovery)
and avoids sending out basic.ack frames when the user-provided tag is considered to be stale.

To quite the Java client docs:

Consider a long running task a consumer has to perform. Say, it takes 15 minutes to complete. In the
15 minute window there is a reasonable chance of connection failure and recovery events. All delivery tags
for the deliveries being processed won't be valid after recovery because they are "reset" for
newly opened channels. This channel implementation will avoid sending out acknowledgements for such
stale delivery tags and avoid a guaranteed channel-level exception (and thus channel closure).

This is a sufficient solution in practice because all unacknowledged deliveries will be requeued
by RabbitMQ automatically when it detects client connection loss.

Channels also inherit delivery offsets when they are replaced ("reopened") during a connection recovery event. This part will likely need more changes in Bunny because such inheritance between objects is an afterthought.

Here are three most relevant commits in the Java client:

Relevant but cannot be worked on in parallel to this change: #704.

Activity

added this to the 3.0.0 milestone on Apr 17, 2025
michaelklishin

michaelklishin commented on Apr 21, 2025

@michaelklishin
MemberAuthor

#704 is done, so the ground is ready for this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @michaelklishin

        Issue actions

          Replace versioned delivery tags with a similar concept in the Java client · Issue #710 · ruby-amqp/bunny