Search Results for

    Show / Hide Table of Contents

    Class 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(ConsistentHashMapping) 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
    object
    RoutingLogic
    ConsistentHashingRoutingLogic
    Implements
    INoSerializationVerificationNeeded
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Routing
    Assembly: Akka.dll
    Syntax
    public sealed class ConsistentHashingRoutingLogic : RoutingLogic, INoSerializationVerificationNeeded

    Constructors

    | Edit this page View Source

    ConsistentHashingRoutingLogic(ActorSystem)

    Initializes a new instance of the ConsistentHashingRoutingLogic class.

    note

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

    Declaration
    public ConsistentHashingRoutingLogic(ActorSystem system)
    Parameters
    Type Name Description
    ActorSystem system

    The actor system that owns the router with this logic.

    | Edit this page View Source

    ConsistentHashingRoutingLogic(ActorSystem, int, ConsistentHashMapping)

    Initializes a new instance of the ConsistentHashingRoutingLogic class.

    Declaration
    public ConsistentHashingRoutingLogic(ActorSystem system, int virtualNodesFactor, ConsistentHashMapping hashMapping)
    Parameters
    Type Name Description
    ActorSystem system

    The actor system that owns the router with this logic.

    int virtualNodesFactor

    The number of virtual nodes to use on the hash ring.

    ConsistentHashMapping hashMapping

    The consistent hash mapping function to use on incoming messages.

    Methods

    | Edit this page View Source

    Select(object, Routee[])

    Picks a Routee to receive the message.

    Declaration
    public override Routee Select(object message, Routee[] routees)
    Parameters
    Type Name Description
    object message

    The message that is being routed

    Routee[] routees

    A collection of routees to choose from when receiving the message.

    Returns
    Type Description
    Routee

    A Routee that receives the message.

    Overrides
    RoutingLogic.Select(object, Routee[])
    | Edit this page View Source

    WithHashMapping(ConsistentHashMapping)

    Creates a new ConsistentHashingRoutingLogic router logic with a given ConsistentHashMapping.

    note

    This method is immutable and returns a new instance of the router.

    Declaration
    public ConsistentHashingRoutingLogic WithHashMapping(ConsistentHashMapping mapping)
    Parameters
    Type Name Description
    ConsistentHashMapping mapping

    The ConsistentHashMapping used to configure the new router.

    Returns
    Type Description
    ConsistentHashingRoutingLogic

    A new router logic with the provided mapping.

    Exceptions
    Type Condition
    ArgumentNullException

    This exception is thrown if the given mapping is undefined.

    Implements

    INoSerializationVerificationNeeded

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET