Package org.apache.storm.kafka.spout.subscription

# Class RoundRobinManualPartitioner

java.lang.Object
org.apache.storm.kafka.spout.subscription.RoundRobinManualPartitioner

All Implemented Interfaces:
  `Serializable`, `ManualPartitioner`

public class RoundRobinManualPartitioner extends Object implements ManualPartitioner
Assign partitions in a round robin fashion for all spouts, not just the ones that are alive. Because the parallelism of the spouts does not typically change while running this makes the assignments more stable in the face of crashing spouts.

Round Robin means that first spout of N spouts will get the first partition, and the N+1th partition... The second spout will get the second partition and N+2th partition etc.

See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RoundRobinManualPartitioner()`

- ## Method Summary

  Modifier and Type
  Method
  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.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### RoundRobinManualPartitioner

    public RoundRobinManualPartitioner()

- ## Method Details

  - ### getPartitionsForThisTask

    public Set<org.apache.kafka.common.TopicPartition> getPartitionsForThisTask(List<org.apache.kafka.common.TopicPartition> allPartitionsSorted, TopologyContext context)
    Description copied from interface: `ManualPartitioner`
    Filter the list of all partitions handled by this set of spouts to get only the partitions assigned to this task.
    Specified by:
      `getPartitionsForThisTask` in interface `ManualPartitioner`
    Parameters:
      `allPartitionsSorted` - all of the partitions that the set of spouts want to subscribe to in a strict ordering that is consistent across tasks
      `context` - the context of the topology
    Returns:
      the subset of the partitions that this spout task should handle.