Skip to content

feat(consumer): cap partition consumer retries#3539

Merged
dnwe merged 1 commit into
mainfrom
dnwe/bound-consumer
May 16, 2026
Merged

feat(consumer): cap partition consumer retries#3539
dnwe merged 1 commit into
mainfrom
dnwe/bound-consumer

Conversation

@dnwe
Copy link
Copy Markdown
Collaborator

@dnwe dnwe commented May 14, 2026

A partition consumer currently retries forever after a broker disconnect or other dispatch failure. A single stuck partition can thus keep the consumer-group session alive (no rebalance) while the application sees no messages.

Add Consumer.Retry.Max as an opt-in maximum on the number of dispatch failures. When the max is hit the partition consumer sends ErrConsumerRetriesExhausted on its Errors channel and closes itself; inside a consumer group the deferred sess.cancel() then ends the session and triggers a fresh rejoin, picking up new metadata and a healthy broker. Defaults to 0 (unlimited) to keep existing behaviour.

A partition consumer currently retries forever after a broker disconnect
or other dispatch failure. A single stuck partition can thus keep the
consumer-group session alive (no rebalance) while the application sees
no messages.

Add Consumer.Retry.Max as an opt-in maximum on the number of dispatch
failures. When the max is hit the partition consumer sends
ErrConsumerRetriesExhausted on its Errors channel and closes itself;
inside a consumer group the deferred sess.cancel() then ends the session
and triggers a fresh rejoin, picking up new metadata and a healthy
broker. Defaults to 0 (unlimited) to keep existing behaviour.

Signed-off-by: Dominic Evans <dominic.evans@uk.ibm.com>
@dnwe dnwe added the feat label May 14, 2026
Copy link
Copy Markdown
Collaborator

@hindessm hindessm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dnwe dnwe merged commit 94972f2 into main May 16, 2026
18 checks passed
@dnwe dnwe deleted the dnwe/bound-consumer branch May 16, 2026 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants