Class KafkaTopicPartitionAssigner
java.lang.Object
org.apache.flink.streaming.connectors.kafka.internals.KafkaTopicPartitionAssigner
Deprecated.
Utility for assigning Kafka partitions to consumer subtasks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intDeprecated.static intassign(KafkaTopicPartition partition, int numParallelSubtasks) Deprecated.Returns the index of the target subtask that a specific Kafka partition should be assigned to.
-
Constructor Details
-
KafkaTopicPartitionAssigner
public KafkaTopicPartitionAssigner()Deprecated.
-
-
Method Details
-
assign
Deprecated.Returns the index of the target subtask that a specific Kafka partition should be assigned to.The resulting distribution of partitions of a single topic has the following contract:
- 1. Uniformly distributed across subtasks
- 2. Partitions are round-robin distributed (strictly clockwise w.r.t. ascending subtask indices) by using the partition id as the offset from a starting index (i.e., the index of the subtask which partition 0 of the topic will be assigned to, determined using the topic name).
The above contract is crucial and cannot be broken. Consumer subtasks rely on this contract to locally filter out partitions that it should not subscribe to, guaranteeing that all partitions of a single topic will always be assigned to some subtask in a uniformly distributed manner.
- Parameters:
partition- the Kafka partitionnumParallelSubtasks- total number of parallel subtasks- Returns:
- index of the target subtask that the Kafka partition should be assigned to.
-
assign
Deprecated.
-