Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This KIP introduces one new broker-side extension interface and one new broker configuration.

New Interface

org.apache.kafka.coordinator.group.api.ConsumerGroupRebalanceListener:

 // callback when a consumer group rebalance is detected by the Group Coordinator.

...

/**
* A callback interface that users can implement to get notified when a consumer group rebalance occurs.
* <p>
* This listener is invoked on the broker side (GroupCoordinator) when a consumer group's epoch is bumped,
* which indicates that a rebalance has occurred.

* Implementations of this interface can be used for monitoring, alerting, or logging purposes
* to track which consumer groups are experiencing rebalances.
*/
public interface ConsumerGroupRebalanceListener {

/**
* Called when a consumer group rebalance occurs.
*
* @param groupId The ID of the consumer group that rebalanced
* @param groupEpoch The new group epoch after the rebalance
* @param metadataHash The metadata hash of the group after the rebalance
*/
void onConsumerGroupRebalance(String groupId, int groupEpoch, long metadataHash);
}

New Broker Configuration

group.consumer.rebalance.listener.classes (LIST, default: empty)

...