Constructor and Description |
---|
KafkaTopicPartitionAssigner() |
Modifier and Type | Method and Description |
---|---|
static int |
assign(KafkaTopicPartition partition,
int numParallelSubtasks)
Returns the index of the target subtask that a specific Kafka partition should be assigned
to.
|
public static int assign(KafkaTopicPartition partition, int numParallelSubtasks)
The resulting distribution of partitions of a single topic has the following contract:
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.
partition
- the Kafka partitionnumParallelSubtasks
- total number of parallel subtasksCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.