This is the method to override/implement to create your own Service.
This is the method to override/implement to create your own Service.
Determines whether this service is available (can accept requests with a reasonable likelihood of success).
Determines whether this service is available (can accept requests with a reasonable likelihood of success).
Relinquishes the use of this service instance.
Relinquishes the use of this service instance. Behavior is undefined if apply() is called after resources are relinquished.
(Since version 7.0.0) Use close() instead
ShardingService takes a
Distributor
where the handle is a service. It uses the distributor to distribute requests *only* when the hash function returns Some[Long]. If None is returned, it throwsNotShardableException
. If the underlying service for a particular shard is not available,NotServableException
is thrown. Example: val serviceFactory = KetamaShardingServiceBuilder() .nodes(services) // services is of type Seq[(String, Service[Req,Rep])] .withHash { req => Some(hashCodeOfSomething)} .buildFactory() val service = serviceFactory() service(req) // where req is a Req and may have ShardableRequest mixed in