Class KafkaTopicPartitionAssigner
- java.lang.Object
-
- org.apache.flink.streaming.connectors.kafka.internals.KafkaTopicPartitionAssigner
-
@Internal @Deprecated public class KafkaTopicPartitionAssigner extends Object
Deprecated.Utility for assigning Kafka partitions to consumer subtasks.
-
-
Constructor Summary
Constructors Constructor Description KafkaTopicPartitionAssigner()Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intassign(String topic, int partition, int numParallelSubtasks)Deprecated.static intassign(KafkaTopicPartition partition, int numParallelSubtasks)Deprecated.Returns the index of the target subtask that a specific Kafka partition should be assigned to.
-
-
-
Method Detail
-
assign
public static int assign(KafkaTopicPartition partition, int numParallelSubtasks)
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
public static int assign(String topic, int partition, int numParallelSubtasks)
Deprecated.
-
-