Class ConsistentHashingPool
This class represents a Pool router that sends messages to a Routee determined using consistent-hashing.
Please refer to Consistent
note
Using Resizer with Consistent
Inherited Members
Namespace: Akka.Routing
Assembly: Akka.dll
Syntax
public sealed class ConsistentHashingPool : Pool, ISurrogated, IEquatable<RouterConfig>, IEquatable<Pool>
Constructors
| Improve this Doc View SourceConsistentHashingPool(Config)
Initializes a new instance of the Consistent
note
'virtual-nodes-factor' defaults to 0 (zero) if it is not defined in the provided configuration.
Declaration
public ConsistentHashingPool(Config config)
Parameters
Type | Name | Description |
---|---|---|
Config | config | The configuration used to configure the pool. |
ConsistentHashingPool(Int32)
Initializes a new instance of the Consistent
note
A Consistent
Declaration
public ConsistentHashingPool(int nrOfInstances)
Parameters
Type | Name | Description |
---|---|---|
Int32 | nrOfInstances | The initial number of routees in the pool. |
ConsistentHashingPool(Int32, ConsistentHashMapping)
Initializes a new instance of the Consistent
Declaration
public ConsistentHashingPool(int nrOfInstances, ConsistentHashMapping hashMapping)
Parameters
Type | Name | Description |
---|---|---|
Int32 | nrOfInstances | The initial number of routees in the pool. |
Consistent |
hashMapping | The consistent hash mapping function to use on incoming messages. |
ConsistentHashingPool(Int32, Resizer, SupervisorStrategy, String, Boolean, Int32, ConsistentHashMapping)
Initializes a new instance of the Consistent
Declaration
public ConsistentHashingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false, int virtualNodesFactor = 0, ConsistentHashMapping hashMapping = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | nrOfInstances | The initial number of routees in the pool. |
Resizer | resizer | The resizer to use when dynamically allocating routees to the pool. |
Supervisor |
supervisorStrategy | The strategy to use when supervising the pool. |
String | routerDispatcher | The dispatcher to use when passing messages to the routees. |
Boolean | usePoolDispatcher |
|
Int32 | virtualNodesFactor | The number of virtual nodes to use on the hash ring. |
Consistent |
hashMapping | The consistent hash mapping function to use on incoming messages. |
Properties
| Improve this Doc View SourceVirtualNodesFactor
Virtual nodes used in the ConsistentHash<T>.
Declaration
public int VirtualNodesFactor { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
| Improve this Doc View SourceCreateRouter(ActorSystem)
Creates a router that is responsible for routing messages to routees within the provided system
.
Declaration
public override Router CreateRouter(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
Actor |
system | The actor system that owns this router. |
Returns
Type | Description |
---|---|
Router | The newly created router tied to the given system. |
Overrides
| Improve this Doc View SourceGetNrOfInstances(ActorSystem)
Used by the Akka.
Declaration
public override int GetNrOfInstances(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
Actor |
system | The actor system that owns this router. |
Returns
Type | Description |
---|---|
Int32 | The number of routees associated with this pool. |
Overrides
| Improve this Doc View SourceToSurrogate(ActorSystem)
Creates a surrogate representation of the current Consistent
Declaration
public override ISurrogate ToSurrogate(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
Actor |
system | The actor system that owns this router. |
Returns
Type | Description |
---|---|
ISurrogate | The surrogate representation of the current Consistent |
Overrides
| Improve this Doc View SourceWithDispatcher(String)
Creates a new Consistent
note
This method is immutable and returns a new instance of the router.
Declaration
public ConsistentHashingPool WithDispatcher(string dispatcher)
Parameters
Type | Name | Description |
---|---|---|
String | dispatcher | The dispatcher id used to configure the new router. |
Returns
Type | Description |
---|---|
Consistent |
A new router with the provided dispatcher id. |
WithFallback(RouterConfig)
Configure the current router with an auxiliary router for routes that it does not know how to handle.
Declaration
public override RouterConfig WithFallback(RouterConfig routerConfig)
Parameters
Type | Name | Description |
---|---|---|
Router |
routerConfig | The router to use as an auxiliary source. |
Returns
Type | Description |
---|---|
Router |
The router configured with the auxiliary information. |
Overrides
Exceptions
Type | Condition |
---|---|
Argument |
This exception is thrown if the given |
WithHashMapping(ConsistentHashMapping)
Creates a new Consistent
note
This method is immutable and returns a new instance of the router.
Declaration
public ConsistentHashingPool WithHashMapping(ConsistentHashMapping mapping)
Parameters
Type | Name | Description |
---|---|---|
Consistent |
mapping | The Consistent |
Returns
Type | Description |
---|---|
Consistent |
A new router with the provided |
WithResizer(Resizer)
Creates a new Consistent
note
This method is immutable and returns a new instance of the router.
note
Using Resizer with Consistent
Declaration
public ConsistentHashingPool WithResizer(Resizer resizer)
Parameters
Returns
Type | Description |
---|---|
Consistent |
A new router with the provided |
WithSupervisorStrategy(SupervisorStrategy)
Creates a new Consistent
note
This method is immutable and returns a new instance of the router.
Declaration
public ConsistentHashingPool WithSupervisorStrategy(SupervisorStrategy strategy)
Parameters
Type | Name | Description |
---|---|---|
Supervisor |
strategy | The Supervisor |
Returns
Type | Description |
---|---|
Consistent |
A new router with the provided |
WithVirtualNodesFactor(Int32)
Setting the number of virtual nodes per node, used in Consistent
Declaration
public ConsistentHashingPool WithVirtualNodesFactor(int vnodes)
Parameters
Type | Name | Description |
---|---|---|
Int32 | vnodes |
Returns
Type | Description |
---|---|
Consistent |
A new router with the provided dispatcher id. |