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

Cannot trigger a rebalance without calling poll #153

Closed
emilk opened this issue Oct 2, 2019 · 1 comment · Fixed by #167
Closed

Cannot trigger a rebalance without calling poll #153

emilk opened this issue Oct 2, 2019 · 1 comment · Fixed by #167

Comments

@emilk
Copy link
Contributor

emilk commented Oct 2, 2019

I am trying to implement exactly-once delivery using several consumers (running in different instances). Each message should only end up in exactly ONE consumer. When I start a new consumer I want to trigger an automatic rebalance so that the new consumer gets assigned a few partitions. The existing consumers commits on rebalance, so that the new consumer does not read the same messages (avoiding duplicates).

The problem is that calling subscribe does NOT trigger a rebalance. The only method I have found which reliably triggers a rebalance is a blocking (None timeout) call to poll. The problem is that this will read max.partition.fetch.bytes worth of messages that the existing consumers have already processed, thus creating duplicates.

Is there any other way to trigger a rebalance?

@benesch
Copy link
Collaborator

benesch commented Oct 24, 2019

Interesting! Upstream suggests that you pause the consumer, call poll until the rebalance, and then unpause it: confluentinc/librdkafka#2394

Unfortunately, we don't currently expose pause, but we could! PRs welcome.

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 a pull request may close this issue.

2 participants