public static enum ConsumerPartitionAssignor.RebalanceProtocol extends Enum<ConsumerPartitionAssignor.RebalanceProtocol>
ConsumerPartitionAssignor
implementors can claim supporting one or more rebalance protocols via the
ConsumerPartitionAssignor.supportedProtocols()
, and it is their responsibility to respect the rules
of those protocols in their ConsumerPartitionAssignor.assign(Cluster, GroupSubscription)
implementations.
Failures to follow the rules of the supported protocols would lead to runtime error or undefined behavior.
The EAGER
rebalance protocol requires a consumer to always revoke all its owned
partitions before participating in a rebalance event. It therefore allows a complete reshuffling of the assignment.
COOPERATIVE
rebalance protocol allows a consumer to retain its currently owned
partitions before participating in a rebalance event. The assignor should not reassign any owned partitions
immediately, but instead may indicate consumers the need for partition revocation so that the revoked
partitions can be reassigned to other consumers in the next rebalance event. This is designed for sticky assignment
logic which attempts to minimize partition reassignment with cooperative adjustments.Enum Constant and Description |
---|
COOPERATIVE |
EAGER |
Modifier and Type | Method and Description |
---|---|
static ConsumerPartitionAssignor.RebalanceProtocol |
forId(byte id) |
byte |
id() |
static ConsumerPartitionAssignor.RebalanceProtocol |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ConsumerPartitionAssignor.RebalanceProtocol[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ConsumerPartitionAssignor.RebalanceProtocol EAGER
public static final ConsumerPartitionAssignor.RebalanceProtocol COOPERATIVE
public static ConsumerPartitionAssignor.RebalanceProtocol[] values()
for (ConsumerPartitionAssignor.RebalanceProtocol c : ConsumerPartitionAssignor.RebalanceProtocol.values())
System.out.println(c);
public static ConsumerPartitionAssignor.RebalanceProtocol valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic byte id()
public static ConsumerPartitionAssignor.RebalanceProtocol forId(byte id)