Search Results for

    Show / Hide Table of Contents

    Class ConsistentHashingPool

    This class represents a Pool router that sends messages to a Routee determined using consistent-hashing. Please refer to ConsistentHashingRoutingLogic for more information on consistent hashing.

    note

    Using Resizer with ConsistentHashingPool is potentially harmful, as hash ranges might change radically during live message processing. This router works best with fixed-sized pools or fixed number of routees per node in the event of clustered deployments.

    Inheritance
    object
    RouterConfig
    Pool
    ConsistentHashingPool
    Implements
    ISurrogated
    IEquatable<RouterConfig>
    IEquatable<Pool>
    Inherited Members
    Pool.NrOfInstances
    Pool.UsePoolDispatcher
    Pool.Resizer
    Pool.SupervisorStrategy
    Pool.Props(Props)
    Pool.StopRouterWhenAllRouteesRemoved
    Pool.CreateRouterActor()
    Pool.DefaultSupervisorStrategy
    Pool.Equals(Pool)
    Pool.Equals(object)
    Pool.GetHashCode()
    RouterConfig.RouterDispatcher
    RouterConfig.RoutingLogicController(RoutingLogic)
    RouterConfig.IsManagementMessage(object)
    RouterConfig.VerifyConfig(ActorPath)
    RouterConfig.Equals(RouterConfig)
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Routing
    Assembly: Akka.dll
    Syntax
    public sealed class ConsistentHashingPool : Pool, ISurrogated, IEquatable<RouterConfig>, IEquatable<Pool>

    Constructors

    | Edit this page View Source

    ConsistentHashingPool(Config)

    Initializes a new instance of the ConsistentHashingPool class.

    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.

    | Edit this page View Source

    ConsistentHashingPool(int)

    Initializes a new instance of the ConsistentHashingPool class.

    note

    A ConsistentHashingPool configured in this way uses the DefaultSupervisorStrategy supervisor strategy.

    Declaration
    public ConsistentHashingPool(int nrOfInstances)
    Parameters
    Type Name Description
    int nrOfInstances

    The initial number of routees in the pool.

    | Edit this page View Source

    ConsistentHashingPool(int, ConsistentHashMapping)

    Initializes a new instance of the ConsistentHashingPool class.

    Declaration
    public ConsistentHashingPool(int nrOfInstances, ConsistentHashMapping hashMapping)
    Parameters
    Type Name Description
    int nrOfInstances

    The initial number of routees in the pool.

    ConsistentHashMapping hashMapping

    The consistent hash mapping function to use on incoming messages.

    | Edit this page View Source

    ConsistentHashingPool(int, Resizer, SupervisorStrategy, string, bool, int, ConsistentHashMapping)

    Initializes a new instance of the ConsistentHashingPool class.

    Declaration
    public ConsistentHashingPool(int nrOfInstances, Resizer resizer, SupervisorStrategy supervisorStrategy, string routerDispatcher, bool usePoolDispatcher = false, int virtualNodesFactor = 0, ConsistentHashMapping hashMapping = null)
    Parameters
    Type Name Description
    int nrOfInstances

    The initial number of routees in the pool.

    Resizer resizer

    The resizer to use when dynamically allocating routees to the pool.

    SupervisorStrategy supervisorStrategy

    The strategy to use when supervising the pool.

    string routerDispatcher

    The dispatcher to use when passing messages to the routees.

    bool usePoolDispatcher

    true to use the pool dispatcher; otherwise false.

    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.

    Properties

    | Edit this page View Source

    VirtualNodesFactor

    Virtual nodes used in the ConsistentHash<T>.

    Declaration
    public int VirtualNodesFactor { get; }
    Property Value
    Type Description
    int

    Methods

    | Edit this page View Source

    CreateRouter(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
    RouterConfig.CreateRouter(ActorSystem)
    | Edit this page View Source

    GetNrOfInstances(ActorSystem)

    Used by the Akka.Routing.RoutedActorCell to determine the initial number of routees.

    Declaration
    public override int GetNrOfInstances(ActorSystem system)
    Parameters
    Type Name Description
    ActorSystem system

    The actor system that owns this router.

    Returns
    Type Description
    int

    The number of routees associated with this pool.

    Overrides
    Pool.GetNrOfInstances(ActorSystem)
    | Edit this page View Source

    ToSurrogate(ActorSystem)

    Creates a surrogate representation of the current ConsistentHashingPool.

    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 ConsistentHashingPool.

    Overrides
    RouterConfig.ToSurrogate(ActorSystem)
    | Edit this page View Source

    WithDispatcher(string)

    Creates a new ConsistentHashingPool router with a given dispatcher id.

    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
    ConsistentHashingPool

    A new router with the provided dispatcher id.

    | Edit this page View Source

    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
    RouterConfig.WithFallback(RouterConfig)
    Exceptions
    Type Condition
    ArgumentException

    This exception is thrown if the given routerConfig is not a ConsistentHashingPool.

    | Edit this page View Source

    WithHashMapping(ConsistentHashMapping)

    Creates a new ConsistentHashingPool router with a given ConsistentHashMapping.

    note

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

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

    The ConsistentHashMapping used to configure the new router.

    Returns
    Type Description
    ConsistentHashingPool

    A new router with the provided mapping.

    | Edit this page View Source

    WithResizer(Resizer)

    Creates a new ConsistentHashingPool router with a given Resizer.

    note

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

    note

    Using Resizer with ConsistentHashingPool is potentially harmful, as hash ranges might change radically during live message processing. This router works best with fixed-sized pools or fixed number of routees per node in the event of clustered deployments.

    Declaration
    public ConsistentHashingPool WithResizer(Resizer resizer)
    Parameters
    Type Name Description
    Resizer resizer

    The Resizer used to configure the new router.

    Returns
    Type Description
    ConsistentHashingPool

    A new router with the provided resizer.

    | Edit this page View Source

    WithSupervisorStrategy(SupervisorStrategy)

    Creates a new ConsistentHashingPool router with a given SupervisorStrategy.

    note

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

    Declaration
    public ConsistentHashingPool WithSupervisorStrategy(SupervisorStrategy strategy)
    Parameters
    Type Name Description
    SupervisorStrategy strategy

    The SupervisorStrategy used to configure the new router.

    Returns
    Type Description
    ConsistentHashingPool

    A new router with the provided strategy.

    | Edit this page View Source

    WithVirtualNodesFactor(int)

    Setting the number of virtual nodes per node, used in ConsistentHash.

    Declaration
    public ConsistentHashingPool WithVirtualNodesFactor(int vnodes)
    Parameters
    Type Name Description
    int vnodes
    Returns
    Type Description
    ConsistentHashingPool

    A new router with the provided dispatcher id.

    Implements

    ISurrogated
    IEquatable<T>
    IEquatable<T>

    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