@FunctionalInterface public interface ManualPartitioner extends Serializable
A function used to assign partitions to this spout.
WARNING if this is not done correctly you can really mess things up, like not reading data in some partitions. The complete TopologyContext is passed in, but it is suggested that you use the index of the spout and the total number of spouts to avoid missing partitions or double assigning partitions.
Modifier and Type | Method and Description |
---|---|
Set<org.apache.kafka.common.TopicPartition> |
getPartitionsForThisTask(List<org.apache.kafka.common.TopicPartition> allPartitionsSorted,
TopologyContext context)
Filter the list of all partitions handled by this set of spouts to get only the partitions assigned to this task.
|
Set<org.apache.kafka.common.TopicPartition> getPartitionsForThisTask(List<org.apache.kafka.common.TopicPartition> allPartitionsSorted, TopologyContext context)
Filter the list of all partitions handled by this set of spouts to get only the partitions assigned to this task.
allPartitionsSorted
- all of the partitions that the set of spouts want to subscribe to in a strict ordering that is consistent across taskscontext
- the context of the topologyCopyright © 2022 The Apache Software Foundation. All rights reserved.