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

No access to consumer in rebalance callbacks #627

Open
farico opened this issue Nov 10, 2023 · 0 comments
Open

No access to consumer in rebalance callbacks #627

farico opened this issue Nov 10, 2023 · 0 comments

Comments

@farico
Copy link

farico commented Nov 10, 2023

Currently we are limited to only receiving Rebalance enum on ConsumerContext which limits us from doing any offset manipulations (like committing offsets on partition that is about to be revoked) as it has no access to consumer:

impl ConsumerContext for CustomContext {
    fn pre_rebalance(&self, rebalance: &Rebalance) {
        info!("Pre rebalance {:?}", rebalance);
    }

    fn post_rebalance(&self, rebalance: &Rebalance) {
        info!("Post rebalance {:?}", rebalance);
    }

    fn commit_callback(&self, result: KafkaResult<()>, _offsets: &TopicPartitionList) {
        info!("Committing offsets: {:?}", result);
    }
}

This is rather limiting if we want to commit processed offsets during rebalance. Java API provides access to consumer and so does C++.

If we try to override the rebalance we still can't access NativeClient as it is private.

Can we also have access to consumer in pre_rebalance and post_rebalance?

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

No branches or pull requests

1 participant