public final class ClusterReceptionist
extends java.lang.Object
implements akka.actor.Actor, akka.actor.ActorLogging
ClusterClient
connects to this actor to retrieve. The ClusterReceptionist
is
supposed to be started on all nodes, or all nodes with specified role, in the cluster.
The receptionist can be started with the ClusterClientReceptionist
or as an
ordinary actor (use the factory method props(akka.actor.ActorRef, akka.cluster.client.ClusterReceptionistSettings)
).
The receptionist forwards messages from the client to the associated DistributedPubSubMediator
,
i.e. the client can send messages to any actor in the cluster that is registered in the
DistributedPubSubMediator
. Messages from the client are wrapped in
DistributedPubSubMediator.Send
, DistributedPubSubMediator.SendToAll
or DistributedPubSubMediator.Publish
with the semantics described in
DistributedPubSubMediator
.
Response messages from the destination actor are tunneled via the receptionist
to avoid inbound connections from other cluster nodes to the client, i.e.
the sender()
, as seen by the destination actor, is not the client itself.
The sender()
of the response messages, as seen by the client, is deadLetters
since the client should normally send subsequent messages via the ClusterClient
.
It is possible to pass the the original sender inside the reply messages if
the client is supposed to communicate directly to the actor in the cluster.
Modifier and Type | Class and Description |
---|---|
static class |
ClusterReceptionist.Internal$
INTERNAL API
|
Constructor and Description |
---|
ClusterReceptionist(akka.actor.ActorRef pubSubMediator,
akka.cluster.client.ClusterReceptionistSettings settings) |
Modifier and Type | Method and Description |
---|---|
akka.cluster.Cluster |
cluster() |
akka.routing.ConsistentHash<akka.actor.Address> |
consistentHash() |
boolean |
matchingRole(akka.cluster.Member m) |
scala.collection.immutable.SortedSet<akka.actor.Address> |
nodes() |
void |
postStop() |
void |
preStart() |
static akka.actor.Props |
props(akka.actor.ActorRef pubSubMediator,
akka.cluster.client.ClusterReceptionistSettings settings)
Scala API: Factory method for
ClusterReceptionist Props . |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive() |
akka.actor.ActorRef |
responseTunnel(akka.actor.ActorRef client) |
int |
virtualNodesFactor() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public ClusterReceptionist(akka.actor.ActorRef pubSubMediator, akka.cluster.client.ClusterReceptionistSettings settings)
public static akka.actor.Props props(akka.actor.ActorRef pubSubMediator, akka.cluster.client.ClusterReceptionistSettings settings)
ClusterReceptionist
Props
.pubSubMediator
- (undocumented)settings
- (undocumented)public akka.cluster.Cluster cluster()
public scala.collection.immutable.SortedSet<akka.actor.Address> nodes()
public int virtualNodesFactor()
public akka.routing.ConsistentHash<akka.actor.Address> consistentHash()
public void preStart()
preStart
in interface akka.actor.Actor
public void postStop()
postStop
in interface akka.actor.Actor
public boolean matchingRole(akka.cluster.Member m)
public akka.actor.ActorRef responseTunnel(akka.actor.ActorRef client)
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
receive
in interface akka.actor.Actor