Enum ConsumerPartitionAssignor.RebalanceProtocol
- java.lang.Object
-
- java.lang.Enum<ConsumerPartitionAssignor.RebalanceProtocol>
-
- org.apache.kafka.clients.consumer.ConsumerPartitionAssignor.RebalanceProtocol
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ConsumerPartitionAssignor.RebalanceProtocol>
- Enclosing interface:
- ConsumerPartitionAssignor
public static enum ConsumerPartitionAssignor.RebalanceProtocol extends java.lang.Enum<ConsumerPartitionAssignor.RebalanceProtocol>
The rebalance protocol defines partition assignment and revocation semantics. The purpose is to establish a consistent set of rules that all consumers in a group follow in order to transfer ownership of a partition.ConsumerPartitionAssignor
implementors can claim supporting one or more rebalance protocols via theConsumerPartitionAssignor.supportedProtocols()
, and it is their responsibility to respect the rules of those protocols in theirConsumerPartitionAssignor.assign(Cluster, GroupSubscription)
implementations. Failures to follow the rules of the supported protocols would lead to runtime error or undefined behavior. TheEAGER
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 Summary
Enum Constants Enum Constant Description COOPERATIVE
EAGER
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ConsumerPartitionAssignor.RebalanceProtocol
forId(byte id)
byte
id()
static ConsumerPartitionAssignor.RebalanceProtocol
valueOf(java.lang.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.
-
-
-
Enum Constant Detail
-
EAGER
public static final ConsumerPartitionAssignor.RebalanceProtocol EAGER
-
COOPERATIVE
public static final ConsumerPartitionAssignor.RebalanceProtocol COOPERATIVE
-
-
Method Detail
-
values
public static ConsumerPartitionAssignor.RebalanceProtocol[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ConsumerPartitionAssignor.RebalanceProtocol c : ConsumerPartitionAssignor.RebalanceProtocol.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ConsumerPartitionAssignor.RebalanceProtocol valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
id
public byte id()
-
forId
public static ConsumerPartitionAssignor.RebalanceProtocol forId(byte id)
-
-