I'm using kafka consumer api 0.10.2.1.
KafkaConsumer provides a callback for partition assignment and revoking:
consumer.subscribe(topics, consumerRebalanceListener);
Where consumerRebalanceListener
has two methods:
public void onPartitionsRevoked(Collection<TopicPartition> partitions);
public void onPartitionsAssigned(Collection<TopicPartition> partitions);
As everything in Kafka consumer happens in single thread, and inside poll() method, these callbacks are called from inside poll()
method.
The question is, can they both be called from one poll()
call or they always require two separate poll()
calls?