Interface PartitionSelectorStrategy


public interface PartitionSelectorStrategy
Strategy for determining the partition to which a message should be sent.
Author:
Gary Russell
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    selectPartition(Object key, int partitionCount)
    Determine the partition based on a key.
  • Method Details

    • selectPartition

      int selectPartition(Object key, int partitionCount)
      Determine the partition based on a key. The partitionCount is 1 greater than the maximum value of a valid partition. Typical implementations will return someValue % partitionCount. The caller will apply that same modulo operation (as well as enforcing absolute value) if the value exceeds partitionCount - 1.
      Parameters:
      key - the key
      partitionCount - the number of partitions
      Returns:
      the partition