package org.apache.kafka.clients.consumer;
interface ConsumerRebalanceListener {
void onPartitionsAssigned(Collection<TopicPartition> partitions);
void onPartitionsRevoked(Collection<TopicPartition> partitions);
}
ConsumerRebalanceListener
ConsumerRebalanceListener
is a callback interface to be notified when the set of partitions assigned to the consumer (aka assignment) changes.
ConsumerRebalanceListener
is notified about the newly-assigned partitions through onPartitionsAssigned callback that happens when ConsumerCoordinator
is requested to onJoinComplete.
ConsumerRebalanceListener
is notified about the partitions revoked through onPartitionsRevoked callback that happens when ConsumerCoordinator
is requested to onJoinPrepare.
Caution
|
FIXME Picture when the notifications are triggered |
ConsumerRebalanceListener
is used when a Kafka Consumer
is requested to subscribe to topics.
void subscribe(Collection<String> topics, ConsumerRebalanceListener callback);
void subscribe(Pattern pattern, ConsumerRebalanceListener callback);
Method | Description |
---|---|
Used exclusively when |
|
Used exclusively when |