Package akka.routing

Class ConsistentHashingRoutingLogic$

  • All Implemented Interfaces:
    java.io.Serializable, scala.Serializable

    public class ConsistentHashingRoutingLogic$
    extends java.lang.Object
    implements scala.Serializable
    See Also:
    Serialized Form
    • Constructor Detail

      • ConsistentHashingRoutingLogic$

        public ConsistentHashingRoutingLogic$()
    • Method Detail

      • $lessinit$greater$default$2

        public int $lessinit$greater$default$2()
        Uses consistent hashing to select a routee based on the sent message.

        There is 3 ways to define what data to use for the consistent hash key.

        1. You can define hashMapping / withHashMapper of the router to map incoming messages to their consistent hash key. This makes the decision transparent for the sender.

        2. The messages may implement ConsistentHashingRouter.ConsistentHashable. The key is part of the message and it's convenient to define it together with the message definition.

        3. The messages can be wrapped in a ConsistentHashingRouter.ConsistentHashableEnvelope to define what data to use for the consistent hash key. The sender knows the key to use.

        These ways to define the consistent hash key can be use together and at the same time for one router. The hashMapping is tried first.

        Parameters:
        virtualNodesFactor - number of virtual nodes per node, used in ConsistentHash

        hashMapping - partial function from message to the data to use for the consistent hash key

        system - the actor system hosting this router

        Returns:
        (undocumented)
      • $lessinit$greater$default$3

        public scala.PartialFunction<java.lang.Object,​java.lang.Object> $lessinit$greater$default$3()
      • apply

        public ConsistentHashingRoutingLogic apply​(ActorSystem system,
                                                   int virtualNodesFactor,
                                                   scala.PartialFunction<java.lang.Object,​java.lang.Object> hashMapping)
        Uses consistent hashing to select a routee based on the sent message.

        There is 3 ways to define what data to use for the consistent hash key.

        1. You can define hashMapping / withHashMapper of the router to map incoming messages to their consistent hash key. This makes the decision transparent for the sender.

        2. The messages may implement ConsistentHashingRouter.ConsistentHashable. The key is part of the message and it's convenient to define it together with the message definition.

        3. The messages can be wrapped in a ConsistentHashingRouter.ConsistentHashableEnvelope to define what data to use for the consistent hash key. The sender knows the key to use.

        These ways to define the consistent hash key can be use together and at the same time for one router. The hashMapping is tried first.

        Parameters:
        virtualNodesFactor - number of virtual nodes per node, used in ConsistentHash

        hashMapping - partial function from message to the data to use for the consistent hash key

        system - the actor system hosting this router

        Returns:
        (undocumented)
      • apply$default$2

        public int apply$default$2()
      • apply$default$3

        public scala.PartialFunction<java.lang.Object,​java.lang.Object> apply$default$3()