SimpleShardingRegistrar
class SimpleShardingRegistrar(registrar: MutableMap<String, AggregateIdSharding> = ConcurrentHashMap()) : ShardingRegistrar, MutableMap<String, AggregateIdSharding>
Simple thread-safe implementation of ShardingRegistrar using ConcurrentHashMap.
This class provides a basic implementation of the ShardingRegistrar interface using a ConcurrentHashMap for storage, making it safe for concurrent access in multi-threaded environments.
Example usage:
val registrar = SimpleShardingRegistrar()
// Register sharding strategies
registrar["orders"] = SingleAggregateIdSharding("order-node-1")
registrar["users"] = SingleAggregateIdSharding("user-node-1")
// Or using the register method
val namedSharding = MyNamedSharding("products")
registrar.register(namedSharding)
// Retrieve sharding strategies
val orderSharding = registrar["orders"]Content copied to clipboard
See also
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Registers a named sharding strategy in this registrar.