Class CooperativeStickyAssignor

java.lang.Object
org.apache.kafka.clients.consumer.internals.AbstractPartitionAssignor
org.apache.kafka.clients.consumer.internals.AbstractStickyAssignor
org.apache.kafka.clients.consumer.CooperativeStickyAssignor
All Implemented Interfaces:
ConsumerPartitionAssignor

public class CooperativeStickyAssignor extends org.apache.kafka.clients.consumer.internals.AbstractStickyAssignor
A cooperative version of the AbstractStickyAssignor. This follows the same (sticky) assignment logic as StickyAssignor but allows for cooperative rebalancing while the StickyAssignor follows the eager rebalancing protocol. See ConsumerPartitionAssignor.RebalanceProtocol for an explanation of the rebalancing protocols.

Users should prefer this assignor for newer clusters.

To turn on cooperative rebalancing you must set all your consumers to use this PartitionAssignor, or implement a custom one that returns RebalanceProtocol.COOPERATIVE in supportedProtocols().

IMPORTANT: if upgrading from 2.3 or earlier, you must follow a specific upgrade path in order to safely turn on cooperative rebalancing. See the upgrade guide for details.