Closed serj026 closed 2 months ago
Thanks for trying this out - I'll give this a look.
Alright, I think I figured it out, the case where the rebalance_cb is a function in the config is handled correctly, but the case where it's a boolean is not handled correctly. I pushed a fix onto the dev_early_access_development_branch and it'll be included in the next release. I'll be adding a test for it too, but you can continue with your POC.
Also, one more thing, the incrementalAssign/incrementalUnassign (or for that matter, the assign/unassign), it's already called by the library in case where rebalance_cb is a boolean. The sequence of events is like this, for example in case of an assign:
rebalance
event.rebalance.error
of type ERR__CONFLICT
, saying that whatever you're trying to assign is already assigned.)You could ignore this error, or else, just change the values contained within the assignment
that is passed to the rebalance event handler if you want to modify the assignment.
@milindl Thanks for the explanation!
Fix included in latest release.
Hello, I noticed that COOPERATIVE rebalance (incremental assign/unassign bindings) was implemented in confluent-kafka-javascript library, which is currently not supported by node-rdkafka. I made a small POC to see how it works in Node.js, but encountered a problem where the following error occurs during rebalance:
Debugging showed that the KafkaConsumer::IncrementalAssign method in kafka-consumer.cc is indeed called, and the consumer method
consumer->incremental_assign(partitions)
is also called with the correct arguments. What happened next in C++ code of librdkafka is hard for me to say, butrko->rko_u.assign.method
does not return RD_KAFKA_ASSIGN_METHOD_INCR_ASSIGN or RD_KAFKA_ASSIGN_METHOD_INCR_UNASSIGN here: https://github.com/confluentinc/librdkafka/blob/master/src/rdkafka_cgrp.c#L4842Kafka consumer:
Rebalance callback:
For testing, used the library version 0.1.11-devel from npm and a manual build of the project from the dev_early_access_development_branch branch.
What could be the reason for this problem?
Environment Information