Interface PartitionSelectorStrategy
-
public interface PartitionSelectorStrategyStrategy for determining the partition to which a message should be sent.- Author:
- Gary Russell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intselectPartition(Object key, int partitionCount)Determine the partition based on a key.
-
-
-
Method Detail
-
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 returnsomeValue % partitionCount. The caller will apply that same modulo operation (as well as enforcing absolute value) if the value exceeds partitionCount - 1.- Parameters:
key- the keypartitionCount- the number of partitions- Returns:
- the partition
-
-