public final class Router
extends java.lang.Object
implements scala.Product, scala.Serializable
route(java.lang.Object, akka.actor.ActorRef)
method the
RoutingLogic
decides to which Routee
to send the message. The Routee
itself
knows how to perform the actual sending. Normally the RoutingLogic
picks one of the
contained routees
, but that is up to the implementation of the RoutingLogic
.
A Router
is immutable and the RoutingLogic
must be thread safe.
Constructor and Description |
---|
Router(RoutingLogic logic)
Java API
|
Router(RoutingLogic logic,
scala.collection.immutable.IndexedSeq<Routee> routees) |
Router(RoutingLogic logic,
java.lang.Iterable<Routee> routees)
Java API
|
Modifier and Type | Method and Description |
---|---|
Router |
addRoutee(ActorRef ref)
Create a new instance with one more
ActorRefRoutee for the
specified ActorRef and the same RoutingLogic . |
Router |
addRoutee(ActorSelection sel)
Create a new instance with one more
ActorSelectionRoutee for the
specified ActorSelection and the same RoutingLogic . |
Router |
addRoutee(Routee routee)
Create a new instance with one more routee and the same
RoutingLogic . |
abstract static boolean |
canEqual(java.lang.Object that) |
abstract static boolean |
equals(java.lang.Object that) |
RoutingLogic |
logic() |
abstract static int |
productArity() |
abstract static java.lang.Object |
productElement(int n) |
static scala.collection.Iterator<java.lang.Object> |
productIterator() |
static java.lang.String |
productPrefix() |
Router |
removeRoutee(ActorRef ref)
Create a new instance without the
ActorRefRoutee for the specified
ActorRef . |
Router |
removeRoutee(ActorSelection sel)
Create a new instance without the
ActorSelectionRoutee for the specified
ActorSelection . |
Router |
removeRoutee(Routee routee)
Create a new instance without the specified routee.
|
void |
route(java.lang.Object message,
ActorRef sender)
Send the message to the destination
Routee selected by the RoutingLogic . |
scala.collection.immutable.IndexedSeq<Routee> |
routees() |
Router |
withRoutees(scala.collection.immutable.IndexedSeq<Routee> rs)
Create a new instance with the specified routees and the same
RoutingLogic . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public Router(RoutingLogic logic, scala.collection.immutable.IndexedSeq<Routee> routees)
public Router(RoutingLogic logic)
logic
- (undocumented)public Router(RoutingLogic logic, java.lang.Iterable<Routee> routees)
logic
- (undocumented)routees
- (undocumented)public abstract static boolean canEqual(java.lang.Object that)
public abstract static boolean equals(java.lang.Object that)
public abstract static java.lang.Object productElement(int n)
public abstract static int productArity()
public static scala.collection.Iterator<java.lang.Object> productIterator()
public static java.lang.String productPrefix()
public RoutingLogic logic()
public scala.collection.immutable.IndexedSeq<Routee> routees()
public void route(java.lang.Object message, ActorRef sender)
Routee
selected by the RoutingLogic
.
If the message is a RouterEnvelope
it will be unwrapped
before sent to the destinations.
Messages wrapped in a Broadcast
envelope are always sent to all routees
.message
- (undocumented)sender
- (undocumented)public Router withRoutees(scala.collection.immutable.IndexedSeq<Routee> rs)
RoutingLogic
.rs
- (undocumented)public Router addRoutee(Routee routee)
RoutingLogic
.routee
- (undocumented)public Router addRoutee(ActorRef ref)
ActorRefRoutee
for the
specified ActorRef
and the same RoutingLogic
.ref
- (undocumented)public Router addRoutee(ActorSelection sel)
ActorSelectionRoutee
for the
specified ActorSelection
and the same RoutingLogic
.sel
- (undocumented)public Router removeRoutee(Routee routee)
routee
- (undocumented)public Router removeRoutee(ActorRef ref)
ActorRefRoutee
for the specified
ActorRef
.ref
- (undocumented)public Router removeRoutee(ActorSelection sel)
ActorSelectionRoutee
for the specified
ActorSelection
.sel
- (undocumented)