akka.routing
Interface RouterConfig

All Known Implementing Classes:
AdaptiveLoadBalancingRouter, BroadcastRouter, ClusterRouterConfig, ConsistentHashingRouter, CustomRouterConfig, FromConfig, FromConfig$, NoRouter, NoRouter$, RandomRouter, RemoteRouterConfig, RoundRobinRouter, ScatterGatherFirstCompletedRouter, SmallestMailboxRouter

public interface RouterConfig

This trait represents a router factory: it produces the actual router actor and creates the routing table (a function which determines the recipients for each message which is to be dispatched). The resulting RoutedActorRef optimizes the sending of the message so that it does NOT go through the router’s mailbox unless the route returns an empty recipient set.

'''Caution:''' This means that the route function is evaluated concurrently without protection by the RoutedActorRef: either provide a reentrant (i.e. pure) implementation or do the locking yourself!

'''Caution:''' Please note that the Router which needs to be returned by createActor() should not send a message to itself in its constructor or preStart() or publish its self reference from there: if someone tries sending a message to that reference before the constructor of RoutedActorRef has returned, there will be a NullPointerException!


Method Summary
 Router createActor()
          The router "head" actor.
 scala.PartialFunction<scala.Tuple2<ActorRef,java.lang.Object>,scala.collection.immutable.Iterable<Destination>> createRoute(RouteeProvider routeeProvider)
          Implement the routing logic by returning a partial function of partial function from (sender, message) to a set of destinations.
 RouteeProvider createRouteeProvider(ActorContext context, Props routeeProps)
          The RouteeProvider responsible for creating or looking up routees.
 scala.Option<Resizer> resizer()
          Routers with dynamically resizable number of routees return the Resizer to use.
 java.lang.String routerDispatcher()
          Dispatcher ID to use for running the “head” actor, i.e.
 boolean stopRouterWhenAllRouteesRemoved()
           
 SupervisorStrategy supervisorStrategy()
          SupervisorStrategy for the created Router actor.
 scala.collection.immutable.Iterable<Destination> toAll(ActorRef sender, scala.collection.immutable.Iterable<ActorRef> routees)
           
 void verifyConfig(ActorPath path)
          Check that everything is there which is needed.
 RouterConfig withFallback(RouterConfig other)
          Overridable merge strategy, by default completely prefers “this” (i.e.
 

Method Detail

createRoute

scala.PartialFunction<scala.Tuple2<ActorRef,java.lang.Object>,scala.collection.immutable.Iterable<Destination>> createRoute(RouteeProvider routeeProvider)
Implement the routing logic by returning a partial function of partial function from (sender, message) to a set of destinations. This Route will be applied for each incoming message.

When createRoute is called the routees should also be registered, typically by using createRoutees or registerRouteesFor of the supplied RouteeProvider.


createRouteeProvider

RouteeProvider createRouteeProvider(ActorContext context,
                                    Props routeeProps)
The RouteeProvider responsible for creating or looking up routees. It's used in createRoute to register routees, and also from Resizer.


createActor

Router createActor()
The router "head" actor.


supervisorStrategy

SupervisorStrategy supervisorStrategy()
SupervisorStrategy for the created Router actor.


routerDispatcher

java.lang.String routerDispatcher()
Dispatcher ID to use for running the “head” actor, i.e. the Router.


withFallback

RouterConfig withFallback(RouterConfig other)
Overridable merge strategy, by default completely prefers “this” (i.e. no merge).


toAll

scala.collection.immutable.Iterable<Destination> toAll(ActorRef sender,
                                                       scala.collection.immutable.Iterable<ActorRef> routees)

resizer

scala.Option<Resizer> resizer()
Routers with dynamically resizable number of routees return the Resizer to use. The resizer is invoked once when the router is created, before any messages can be sent to it. Resize is also triggered when messages are sent to the routees, and the resizer is invoked asynchronously, i.e. not necessarily before the message has been sent.


verifyConfig

void verifyConfig(ActorPath path)
Check that everything is there which is needed. Called in constructor of RoutedActorRef to fail early.


stopRouterWhenAllRouteesRemoved

boolean stopRouterWhenAllRouteesRemoved()