Package akka.routing
Class Router
- java.lang.Object
-
- akka.routing.Router
-
- All Implemented Interfaces:
java.io.Serializable,scala.Equals,scala.Product
public final class Router extends java.lang.Object implements scala.Product, java.io.SerializableFor each message that is sent through the router via theroute(java.lang.Object, akka.actor.ActorRef)method theRoutingLogicdecides to whichRouteeto send the message. TheRouteeitself knows how to perform the actual sending. Normally theRoutingLogicpicks one of the containedroutees, but that is up to the implementation of theRoutingLogic.A
Routeris immutable and theRoutingLogicmust be thread safe.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Router(RoutingLogic logic)Java APIRouter(RoutingLogic logic, java.lang.Iterable<Routee> routees)Java APIRouter(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static scala.collection.immutable.IndexedSeq<Routee>$lessinit$greater$default$2()RouteraddRoutee(ActorRef ref)Create a new instance with one moreActorRefRouteefor the specifiedActorRefand the sameRoutingLogic.RouteraddRoutee(ActorSelection sel)Create a new instance with one moreActorSelectionRouteefor the specifiedActorSelectionand the sameRoutingLogic.RouteraddRoutee(Routee routee)Create a new instance with one more routee and the sameRoutingLogic.static Routerapply(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)static scala.collection.immutable.IndexedSeq<Routee>apply$default$2()booleancanEqual(java.lang.Object x$1)Routercopy(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)RoutingLogiccopy$default$1()scala.collection.immutable.IndexedSeq<Routee>copy$default$2()booleanequals(java.lang.Object x$1)inthashCode()RoutingLogiclogic()intproductArity()java.lang.ObjectproductElement(int x$1)java.lang.StringproductElementName(int x$1)scala.collection.Iterator<java.lang.Object>productIterator()java.lang.StringproductPrefix()RouterremoveRoutee(ActorRef ref)Create a new instance without theActorRefRouteefor the specifiedActorRef.RouterremoveRoutee(ActorSelection sel)Create a new instance without theActorSelectionRouteefor the specifiedActorSelection.RouterremoveRoutee(Routee routee)Create a new instance without the specified routee.voidroute(java.lang.Object message, ActorRef sender)Send the message to the destinationRouteeselected by theRoutingLogic.scala.collection.immutable.IndexedSeq<Routee>routees()java.lang.StringtoString()static scala.Option<scala.Tuple2<RoutingLogic,scala.collection.immutable.IndexedSeq<Routee>>>unapply(Router x$0)RouterwithRoutees(scala.collection.immutable.IndexedSeq<Routee> rs)Create a new instance with the specified routees and the sameRoutingLogic.
-
-
-
Constructor Detail
-
Router
public Router(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)
-
Router
public Router(RoutingLogic logic)
Java API
-
Router
public Router(RoutingLogic logic, java.lang.Iterable<Routee> routees)
Java API
-
-
Method Detail
-
$lessinit$greater$default$2
public static scala.collection.immutable.IndexedSeq<Routee> $lessinit$greater$default$2()
-
apply
public static Router apply(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)
-
apply$default$2
public static scala.collection.immutable.IndexedSeq<Routee> apply$default$2()
-
unapply
public static scala.Option<scala.Tuple2<RoutingLogic,scala.collection.immutable.IndexedSeq<Routee>>> unapply(Router x$0)
-
logic
public RoutingLogic logic()
-
routees
public scala.collection.immutable.IndexedSeq<Routee> routees()
-
route
public void route(java.lang.Object message, ActorRef sender)Send the message to the destinationRouteeselected by theRoutingLogic. If the message is aRouterEnvelopeit will be unwrapped before sent to the destinations. Messages wrapped in aBroadcastenvelope are always sent to allroutees.
-
withRoutees
public Router withRoutees(scala.collection.immutable.IndexedSeq<Routee> rs)
Create a new instance with the specified routees and the sameRoutingLogic.
-
addRoutee
public Router addRoutee(Routee routee)
Create a new instance with one more routee and the sameRoutingLogic.
-
addRoutee
public Router addRoutee(ActorRef ref)
Create a new instance with one moreActorRefRouteefor the specifiedActorRefand the sameRoutingLogic.
-
addRoutee
public Router addRoutee(ActorSelection sel)
Create a new instance with one moreActorSelectionRouteefor the specifiedActorSelectionand the sameRoutingLogic.
-
removeRoutee
public Router removeRoutee(Routee routee)
Create a new instance without the specified routee.
-
removeRoutee
public Router removeRoutee(ActorRef ref)
Create a new instance without theActorRefRouteefor the specifiedActorRef.
-
removeRoutee
public Router removeRoutee(ActorSelection sel)
Create a new instance without theActorSelectionRouteefor the specifiedActorSelection.
-
copy
public Router copy(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)
-
copy$default$1
public RoutingLogic copy$default$1()
-
copy$default$2
public scala.collection.immutable.IndexedSeq<Routee> copy$default$2()
-
productPrefix
public java.lang.String productPrefix()
- Specified by:
productPrefixin interfacescala.Product
-
productArity
public int productArity()
- Specified by:
productArityin interfacescala.Product
-
productElement
public java.lang.Object productElement(int x$1)
- Specified by:
productElementin interfacescala.Product
-
productIterator
public scala.collection.Iterator<java.lang.Object> productIterator()
- Specified by:
productIteratorin interfacescala.Product
-
canEqual
public boolean canEqual(java.lang.Object x$1)
- Specified by:
canEqualin interfacescala.Equals
-
productElementName
public java.lang.String productElementName(int x$1)
- Specified by:
productElementNamein interfacescala.Product
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object x$1)
- Specified by:
equalsin interfacescala.Equals- Overrides:
equalsin classjava.lang.Object
-
-