Description
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:
- The original version
- Additional comments
- An important bug fix we should not miss, even if
delivery_tag
set to0
is a very rare thing to see in practice
Relevant but cannot be worked on in parallel to this change: #704.
Activity
michaelklishin commentedon Apr 21, 2025
#704 is done, so the ground is ready for this change.