Class DefaultPartitionKeyResolver
java.lang.Object
com.opencqrs.framework.eventhandler.partitioning.DefaultPartitionKeyResolver
- All Implemented Interfaces:
PartitionKeyResolver
Default implementation of
PartitionKeyResolver which uses CRC32 checksums and modulo operation to
derive partition numbers from event sequence identifiers.
This implementation is guaranteed to always yield the same partition number for the same event sequence
identifier, as long as the number of activePartitions is constant.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DefaultPartitionKeyResolver
public DefaultPartitionKeyResolver(long activePartitions)
-
-
Method Details
-
resolve
Description copied from interface:PartitionKeyResolverDeterministically resolves a partition number for the given sequence identifier.- Specified by:
resolvein interfacePartitionKeyResolver- Parameters:
sequenceId- the event sequence identifier, as derived fromEventSequenceResolverimplementations- Returns:
- the partition number
-