SingleAggregateIdSharding

Simple sharding implementation that always routes to a single node.

This implementation ignores the aggregate ID and always returns the same node name. It's useful for scenarios where all aggregates of a certain type should be stored on the same node, or for testing purposes.

Example usage:

val sharding = SingleAggregateIdSharding("primary-node")
val shard1 = sharding.sharding(orderId1) // Returns "primary-node"
val shard2 = sharding.sharding(orderId2) // Returns "primary-node"

See also

Constructors

Link copied to clipboard
constructor(node: String)

Properties

Link copied to clipboard

The fixed node name to return for all sharding requests

Functions

Link copied to clipboard
open override fun sharding(aggregateId: AggregateId): String

Returns the fixed node name regardless of the aggregate ID.