public final class ClusterReceptionist extends java.lang.Object implements 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 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
|
Actor.emptyBehavior$, Actor.ignoringBehavior$
Constructor and Description |
---|
ClusterReceptionist(ActorRef pubSubMediator,
ClusterReceptionistSettings settings) |
Modifier and Type | Method and Description |
---|---|
protected abstract static void |
akka$actor$Actor$_setter_$context_$eq(ActorContext x$1) |
protected abstract static void |
akka$actor$Actor$_setter_$self_$eq(ActorRef x$1) |
static void |
akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1) |
static LoggingAdapter |
akka$actor$ActorLogging$$_log() |
protected static void |
aroundPostRestart(java.lang.Throwable reason) |
protected static void |
aroundPostStop() |
protected static void |
aroundPreRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
protected static void |
aroundPreStart() |
protected static void |
aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
java.lang.Object msg) |
Cancellable |
checkDeadlinesTask() |
scala.collection.immutable.HashMap<ActorRef,DeadlineFailureDetector> |
clientInteractions() |
scala.collection.immutable.HashSet<ActorRef> |
clientsPublished() |
Cluster |
cluster() |
ConsistentHash<Address> |
consistentHash() |
ActorContext |
context()
Stores the context for this actor, including self, and sender.
|
static LoggingAdapter |
log() |
boolean |
matchingRole(Member m) |
scala.collection.immutable.SortedSet<Address> |
nodes() |
static void |
postRestart(java.lang.Throwable reason) |
void |
postStop()
User overridable callback.
|
static void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message) |
void |
preStart()
User overridable callback.
|
static Props |
props(ActorRef pubSubMediator,
ClusterReceptionistSettings settings)
Scala API: Factory method for
ClusterReceptionist Props . |
void |
publishClientsUnreachable() |
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receive()
This defines the initial actor behavior, it must return a partial function
with the actor logic.
|
ActorRef |
responseTunnel(ActorRef client) |
ActorRef |
self()
The 'self' field holds the ActorRef for this actor.
|
static ActorRef |
sender() |
scala.collection.immutable.Vector<ActorRef> |
subscribers() |
static SupervisorStrategy |
supervisorStrategy() |
static void |
unhandled(java.lang.Object message) |
void |
updateClientInteractions(ActorRef client) |
boolean |
verboseHeartbeat() |
int |
virtualNodesFactor() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, sender, supervisorStrategy, unhandled
log
public ClusterReceptionist(ActorRef pubSubMediator, ClusterReceptionistSettings settings)
public static Props props(ActorRef pubSubMediator, ClusterReceptionistSettings settings)
ClusterReceptionist
Props
.pubSubMediator
- (undocumented)settings
- (undocumented)public static final ActorRef sender()
protected static void aroundReceive(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, java.lang.Object msg)
protected static void aroundPreStart()
protected static void aroundPostStop()
protected static void aroundPreRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
protected static void aroundPostRestart(java.lang.Throwable reason)
public static SupervisorStrategy supervisorStrategy()
public static void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message) throws java.lang.Exception
java.lang.Exception
public static void postRestart(java.lang.Throwable reason) throws java.lang.Exception
java.lang.Exception
public static void unhandled(java.lang.Object message)
protected abstract static void akka$actor$Actor$_setter_$context_$eq(ActorContext x$1)
protected abstract static void akka$actor$Actor$_setter_$self_$eq(ActorRef x$1)
public static LoggingAdapter akka$actor$ActorLogging$$_log()
public static void akka$actor$ActorLogging$$_log_$eq(LoggingAdapter x$1)
public static LoggingAdapter log()
public ActorContext context()
Actor
forward
.
WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
ActorContext
is the Scala API. getContext
returns a
UntypedActorContext
, which is the Java API of the actor
context.
public final ActorRef self()
Actor
self ! message
public Cluster cluster()
public boolean verboseHeartbeat()
public scala.collection.immutable.SortedSet<Address> nodes()
public int virtualNodesFactor()
public ConsistentHash<Address> consistentHash()
public scala.collection.immutable.HashMap<ActorRef,DeadlineFailureDetector> clientInteractions()
public scala.collection.immutable.HashSet<ActorRef> clientsPublished()
public scala.collection.immutable.Vector<ActorRef> subscribers()
public Cancellable checkDeadlinesTask()
public void preStart()
Actor
public void postStop()
Actor
public boolean matchingRole(Member m)
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Actor
public void updateClientInteractions(ActorRef client)
public void publishClientsUnreachable()