C# Class Akka.Routing.ConsistentHashingRoutingLogic

This class contains logic used by a Router to route a message to a Routee determined using consistent-hashing. This process has the router select a routee based on a message's consistent hash key. There are 3 ways to define the key, which can be used individually or combined to form the key. The ConsistentHashMapping is tried first.
  1. You can define a ConsistentHashMapping or use WithHashMapping of the router to map incoming messages to their consistent hash key. This makes the decision transparent for the sender.
  2. Messages may implement IConsistentHashable. The hash key is part of the message and it's convenient to define it together with the message definition.
  3. The message can be wrapped in a ConsistentHashableEnvelope to define what data to use for the consistent hash key. The sender knows what key to use.
Inheritance: RoutingLogic
Mostra file Open project: rogeralsing/akka.net

Public Methods

Method Description
ConsistentHashingRoutingLogic ( ActorSystem system ) : System

Initializes a new instance of the ConsistentHashingRoutingLogic class. A ConsistentHashingRoutingLogic configured in this way uses the ConsistentHashingRouter.EmptyConsistentHashMapping as the hash mapping function with a virtual node factor of 0 (zero).

ConsistentHashingRoutingLogic ( ActorSystem system, int virtualNodesFactor, ConsistentHashMapping hashMapping ) : System

Initializes a new instance of the ConsistentHashingRoutingLogic class.

Select ( object message, Routee routees ) : Routee

Picks a Routee to receive the message.

WithHashMapping ( ConsistentHashMapping mapping ) : ConsistentHashingRoutingLogic

Creates a new ConsistentHashingRoutingLogic router logic with a given ConsistentHashMapping. This method is immutable and returns a new instance of the router.

Method Details

ConsistentHashingRoutingLogic() public method

Initializes a new instance of the ConsistentHashingRoutingLogic class. A ConsistentHashingRoutingLogic configured in this way uses the ConsistentHashingRouter.EmptyConsistentHashMapping as the hash mapping function with a virtual node factor of 0 (zero).
public ConsistentHashingRoutingLogic ( ActorSystem system ) : System
system ActorSystem The actor system that owns the router with this logic.
return System

ConsistentHashingRoutingLogic() public method

Initializes a new instance of the ConsistentHashingRoutingLogic class.
public ConsistentHashingRoutingLogic ( ActorSystem system, int virtualNodesFactor, ConsistentHashMapping hashMapping ) : System
system ActorSystem The actor system that owns the router with this logic.
virtualNodesFactor int The number of virtual nodes to use on the hash ring.
hashMapping ConsistentHashMapping The consistent hash mapping function to use on incoming messages.
return System

Select() public method

Picks a Routee to receive the message.
public Select ( object message, Routee routees ) : Routee
message object The message that is being routed
routees Routee A collection of routees to choose from when receiving the .
return Routee

WithHashMapping() public method

Creates a new ConsistentHashingRoutingLogic router logic with a given ConsistentHashMapping. This method is immutable and returns a new instance of the router.
The mapping can not be null.
public WithHashMapping ( ConsistentHashMapping mapping ) : ConsistentHashingRoutingLogic
mapping ConsistentHashMapping The used to configure the new router.
return ConsistentHashingRoutingLogic