Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return back to the caller on rebalance events #644

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

scanterog
Copy link
Collaborator

This does not affect the StreamConsumer or any other wrapper consumer. It will only incur on an extra Poll call when there's a rebalance event which is negligible.

why is this needed?

When using bindings built upon the rust-rdkafka ffi, the caller is responsible for initiating the rebalance calls (*assign). If a high timeout is specified, the rebalance handler will only be triggered once the timeout period has elapsed. This fixes it by always returning on rebalance events.

Copy link
Collaborator

@davidblewett davidblewett left a comment

Choose a reason for hiding this comment

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

LGTM.

This does not affect the StreamConsumer or any other wrapper consumer.
It will only incur on an extra Poll call when there's a rebalance event.

When using bindings built upon the rust-rdkafka ffi, the caller is
responsible for initiating the rebalance calls (*assign).
If a high timeout is specified, the rebalance handler will only be
triggered once the timeout period has elapsed.

This fixes it by always returning on rebalance events except when
Timeout::Never. Poll calls with timeout::Never are expected to return
a message.
@davidblewett davidblewett force-pushed the scanterog/return-none-on-rebalance branch from ad7a2b8 to d6ec6e1 Compare January 11, 2024 21:35
@davidblewett davidblewett merged commit 9b44aba into master Jan 11, 2024
10 checks passed
@davidblewett davidblewett deleted the scanterog/return-none-on-rebalance branch January 11, 2024 22:24
@acautin
Copy link

acautin commented May 12, 2024

@scanterog or @davidblewett We have a job that starts, check for messages / process then shuts down again as it receives messages quite sporadically (1 or 2 a day).

After this change: When we initialize the client there is a rebalance. The first call to consumer.poll(Duration::from_secs(60)) returns None so the job terminates before reading any messages. Is this intended and if so what can be done to read all the messages ? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants