Interface PartitionSelectorStrategy
public interface PartitionSelectorStrategy
Strategy for determining the partition to which a message should be sent.
- Author:
- Gary Russell
-
Method Summary
Modifier and TypeMethodDescriptionintselectPartition(Object key, int partitionCount) Determine the partition based on a key.
-
Method Details
-
selectPartition
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
-