public class KafkaTopicPartitionAssigner extends Object
|Constructor and Description|
|Modifier and Type||Method and Description|
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 partition
numParallelSubtasks- total number of parallel subtasks
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.