Class ConsistentHashingGroup
This class represents a Group router that sends messages to a Routee determined using consistent-hashing. Please refer to ConsistentHashingRoutingLogic for more information on consistent hashing.
Inherited Members
Namespace: Akka.Routing
Assembly: Akka.dll
Syntax
public sealed class ConsistentHashingGroup : Group, ISurrogated, IEquatable<RouterConfig>, IEquatable<Group>
Constructors
| Improve this Doc View SourceConsistentHashingGroup(Config)
Initializes a new instance of the ConsistentHashingGroup class.
Declaration
public ConsistentHashingGroup(Config config)
Parameters
Type | Name | Description |
---|---|---|
Config | config | The configuration to use to lookup paths used by the group router. noteIf 'routees.path' is defined in the provided configuration then those paths will be used by the router. 'virtual-nodes-factor' defaults to 0 (zero) if it is not defined in the provided configuration. |
ConsistentHashingGroup(IEnumerable<String>)
Initializes a new instance of the ConsistentHashingGroup class.
Declaration
public ConsistentHashingGroup(IEnumerable<string> paths)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | paths | A list of actor paths used by the group router. |
ConsistentHashingGroup(IEnumerable<String>, ConsistentHashMapping)
Initializes a new instance of the ConsistentHashingGroup class.
Declaration
public ConsistentHashingGroup(IEnumerable<string> paths, ConsistentHashMapping hashMapping)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | paths | An enumeration of actor paths used by the group router. |
ConsistentHashMapping | hashMapping | The consistent hash mapping function to use on incoming messages. |
ConsistentHashingGroup(IEnumerable<String>, Int32, ConsistentHashMapping, String)
Initializes a new instance of the ConsistentHashingGroup class.
Declaration
public ConsistentHashingGroup(IEnumerable<string> paths, int virtualNodesFactor, ConsistentHashMapping hashMapping, string routerDispatcher)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<String> | paths | An enumeration of actor paths used by the group router. |
Int32 | virtualNodesFactor | The number of virtual nodes to use on the hash ring. |
ConsistentHashMapping | hashMapping | The consistent hash mapping function to use on incoming messages. |
String | routerDispatcher | The dispatcher to use when passing messages to the routees. |
ConsistentHashingGroup(String[])
Initializes a new instance of the ConsistentHashingGroup class.
Declaration
public ConsistentHashingGroup(params string[] paths)
Parameters
Type | Name | Description |
---|---|---|
String[] | paths |
|
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 |
---|---|---|
ActorSystem | 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 SourceGetPaths(ActorSystem)
Retrieves the actor paths used by this router during routee selection.
Declaration
public override IEnumerable<string> GetPaths(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system | The actor system that owns this router. |
Returns
Type | Description |
---|---|
IEnumerable<String> | An enumeration of actor paths used during routee selection |
Overrides
| Improve this Doc View SourceToSurrogate(ActorSystem)
Creates a surrogate representation of the current ConsistentHashingGroup.
Declaration
public override ISurrogate ToSurrogate(ActorSystem system)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system | The actor system that owns this router. |
Returns
Type | Description |
---|---|
ISurrogate | The surrogate representation of the current ConsistentHashingGroup. |
Overrides
| Improve this Doc View SourceWithDispatcher(String)
Creates a new ConsistentHashingGroup router with a given dispatcher id.
note
This method is immutable and returns a new instance of the router.
Declaration
public ConsistentHashingGroup WithDispatcher(string dispatcher)
Parameters
Type | Name | Description |
---|---|---|
String | dispatcher | The dispatcher id used to configure the new router. |
Returns
Type | Description |
---|---|
ConsistentHashingGroup | 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 |
---|---|---|
RouterConfig | routerConfig | The router to use as an auxiliary source. |
Returns
Type | Description |
---|---|
RouterConfig | The router configured with the auxiliary information. |
Overrides
Exceptions
Type | Condition |
---|---|
ArgumentException | This exception is thrown if the given |
WithHashMapping(ConsistentHashMapping)
Creates a new ConsistentHashingGroup router with a given ConsistentHashMapping.
note
This method is immutable and returns a new instance of the router.
Declaration
public ConsistentHashingGroup WithHashMapping(ConsistentHashMapping mapping)
Parameters
Type | Name | Description |
---|---|---|
ConsistentHashMapping | mapping | The ConsistentHashMapping used to configure the new router. |
Returns
Type | Description |
---|---|
ConsistentHashingGroup | A new router with the provided |
WithVirtualNodesFactor(Int32)
Creates a new ConsistentHashingGroup router with a given VirtualNodesFactor.
note
This method is immutable and returns a new instance of the router.
Declaration
public ConsistentHashingGroup WithVirtualNodesFactor(int vnodes)
Parameters
Type | Name | Description |
---|---|---|
Int32 | vnodes | The VirtualNodesFactor used to configure the new router. |
Returns
Type | Description |
---|---|
ConsistentHashingGroup | A new router with the provided |