Class ClusterClient
- java.lang.Object
-
- org.apache.pekko.cluster.client.ClusterClient
-
- All Implemented Interfaces:
Actor
,ActorLogging
public final class ClusterClient extends java.lang.Object implements Actor, ActorLogging
Deprecated.Use Apache Pekko gRPC instead, see https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-pekko-grpc. Since Akka 2.6.0.This actor is intended to be used on an external node that is not member of the cluster. It acts like a gateway for sending messages to actors somewhere in the cluster. From the initial contact points it will establish a connection to aClusterReceptionist
somewhere in the cluster. It will monitor the connection to the receptionist and establish a new connection if the link goes down. When looking for a new receptionist it uses fresh contact points retrieved from previous establishment, or periodically refreshed contacts, i.e. not necessarily the initial contact points.You can send messages via the
ClusterClient
to any actor in the cluster that is registered in theClusterReceptionist
. Messages are wrapped inClusterClient.Send
,ClusterClient.SendToAll
orClusterClient.Publish
.1.
ClusterClient.Send
- The message will be delivered to one recipient with a matching path, if any such exists. If several entries match the path the message will be delivered to one random destination. The sender of the message can specify that local affinity is preferred, i.e. the message is sent to an actor in the same local actor system as the used receptionist actor, if any such exists, otherwise random to any other matching entry.2.
ClusterClient.SendToAll
- The message will be delivered to all recipients with a matching path.3.
ClusterClient.Publish
- The message will be delivered to all recipients Actors that have been registered as subscribers to to the named topic.Use the factory method
props(org.apache.pekko.cluster.client.ClusterClientSettings)
) to create thepekko.actor.Props
for the actor.If the receptionist is not currently available, the client will buffer the messages and then deliver them when the connection to the receptionist has been established. The size of the buffer is configurable and it can be disabled by using a buffer size of 0. When the buffer is full old messages will be dropped when new messages are sent via the client.
Note that this is a best effort implementation: messages can always be lost due to the distributed nature of the actors involved.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ClusterClient.Internal$
Deprecated.INTERNAL APIstatic class
ClusterClient.Publish
Deprecated.Use Apache Pekko gRPC instead, see https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-pekko-grpc.static class
ClusterClient.Publish$
Deprecated.static class
ClusterClient.Send
Deprecated.Use Apache Pekko gRPC instead, see https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-pekko-grpc.static class
ClusterClient.Send$
Deprecated.static class
ClusterClient.SendToAll
Deprecated.Use Apache Pekko gRPC instead, see https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-pekko-grpc.static class
ClusterClient.SendToAll$
Deprecated.-
Nested classes/interfaces inherited from interface org.apache.pekko.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
-
-
Constructor Summary
Constructors Constructor Description ClusterClient(ClusterClientSettings settings)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
active(ActorRef receptionist)
Deprecated.MessageBuffer
buffer()
Deprecated.void
buffer(java.lang.Object msg)
Deprecated.void
buffer_$eq(MessageBuffer x$1)
Deprecated.scala.collection.immutable.HashSet<ActorPath>
contactPaths()
Deprecated.void
contactPaths_$eq(scala.collection.immutable.HashSet<ActorPath> x$1)
Deprecated.scala.collection.immutable.HashSet<ActorPath>
contactPathsPublished()
Deprecated.void
contactPathsPublished_$eq(scala.collection.immutable.HashSet<ActorPath> x$1)
Deprecated.scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
contactPointMessages()
Deprecated.scala.collection.immutable.HashSet<ActorSelection>
contacts()
Deprecated.void
contacts_$eq(scala.collection.immutable.HashSet<ActorSelection> x$1)
Deprecated.ActorContext
context()
Deprecated.Scala API: Stores the context for this actor, including self, and sender.scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
establishing()
Deprecated.DeadlineFailureDetector
failureDetector()
Deprecated.Cancellable
heartbeatTask()
Deprecated.scala.collection.immutable.HashSet<ActorSelection>
initialContactsSel()
Deprecated.protected void
org$apache$pekko$actor$Actor$_setter_$context_$eq(ActorContext x$1)
Deprecated.Scala API: Stores the context for this actor, including self, and sender.protected void
org$apache$pekko$actor$Actor$_setter_$self_$eq(ActorRef x$1)
Deprecated.The 'self' field holds the ActorRef for this actor.void
postStop()
Deprecated.User overridable callback.static Props
props(ClusterClientSettings settings)
Deprecated.Use Apache Pekko gRPC instead, see https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-pekko-grpc.void
publishContactPoints()
Deprecated.scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit>
receive()
Deprecated.Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.void
reestablish()
Deprecated.scala.Option<Cancellable>
refreshContactsTask()
Deprecated.void
refreshContactsTask_$eq(scala.Option<Cancellable> x$1)
Deprecated.void
scheduleRefreshContactsTick(scala.concurrent.duration.FiniteDuration interval)
Deprecated.ActorRef
self()
Deprecated.The 'self' field holds the ActorRef for this actor.void
sendBuffered(ActorRef receptionist)
Deprecated.void
sendGetContacts()
Deprecated.scala.collection.immutable.Vector<ActorRef>
subscribers()
Deprecated.void
subscribers_$eq(scala.collection.immutable.Vector<ActorRef> x$1)
Deprecated.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.pekko.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, postRestart, preRestart, preStart, sender, supervisorStrategy, unhandled
-
Methods inherited from interface org.apache.pekko.actor.ActorLogging
_log_$eq, log
-
-
-
-
Constructor Detail
-
ClusterClient
public ClusterClient(ClusterClientSettings settings)
Deprecated.
-
-
Method Detail
-
props
public static Props props(ClusterClientSettings settings)
Deprecated.Use Apache Pekko gRPC instead, see https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-pekko-grpc. Since Akka 2.6.0.Scala API: Factory method forClusterClient
pekko.actor.Props
.
-
context
public ActorContext context()
Deprecated.Description copied from interface:Actor
Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such asforward
.WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
pekko.actor.ActorContext
is the Scala API.getContext
returns apekko.actor.AbstractActor.ActorContext
, which is the Java API of the actor context.
-
self
public final ActorRef self()
Deprecated.Description copied from interface:Actor
The 'self' field holds the ActorRef for this actor. Can be used to send messages to itself:self ! message
-
org$apache$pekko$actor$Actor$_setter_$context_$eq
protected void org$apache$pekko$actor$Actor$_setter_$context_$eq(ActorContext x$1)
Deprecated.Description copied from interface:Actor
Scala API: Stores the context for this actor, including self, and sender. It is implicit to support operations such asforward
.WARNING: Only valid within the Actor itself, so do not close over it and publish it to other threads!
pekko.actor.ActorContext
is the Scala API.getContext
returns apekko.actor.AbstractActor.ActorContext
, which is the Java API of the actor context.- Specified by:
org$apache$pekko$actor$Actor$_setter_$context_$eq
in interfaceActor
-
org$apache$pekko$actor$Actor$_setter_$self_$eq
protected final void org$apache$pekko$actor$Actor$_setter_$self_$eq(ActorRef x$1)
Deprecated.Description copied from interface:Actor
The 'self' field holds the ActorRef for this actor. Can be used to send messages to itself:self ! message
- Specified by:
org$apache$pekko$actor$Actor$_setter_$self_$eq
in interfaceActor
-
failureDetector
public DeadlineFailureDetector failureDetector()
Deprecated.
-
contactPaths
public scala.collection.immutable.HashSet<ActorPath> contactPaths()
Deprecated.
-
contactPaths_$eq
public void contactPaths_$eq(scala.collection.immutable.HashSet<ActorPath> x$1)
Deprecated.
-
initialContactsSel
public scala.collection.immutable.HashSet<ActorSelection> initialContactsSel()
Deprecated.
-
contacts
public scala.collection.immutable.HashSet<ActorSelection> contacts()
Deprecated.
-
contacts_$eq
public void contacts_$eq(scala.collection.immutable.HashSet<ActorSelection> x$1)
Deprecated.
-
contactPathsPublished
public scala.collection.immutable.HashSet<ActorPath> contactPathsPublished()
Deprecated.
-
contactPathsPublished_$eq
public void contactPathsPublished_$eq(scala.collection.immutable.HashSet<ActorPath> x$1)
Deprecated.
-
subscribers
public scala.collection.immutable.Vector<ActorRef> subscribers()
Deprecated.
-
subscribers_$eq
public void subscribers_$eq(scala.collection.immutable.Vector<ActorRef> x$1)
Deprecated.
-
heartbeatTask
public Cancellable heartbeatTask()
Deprecated.
-
refreshContactsTask
public scala.Option<Cancellable> refreshContactsTask()
Deprecated.
-
refreshContactsTask_$eq
public void refreshContactsTask_$eq(scala.Option<Cancellable> x$1)
Deprecated.
-
buffer
public MessageBuffer buffer()
Deprecated.
-
buffer_$eq
public void buffer_$eq(MessageBuffer x$1)
Deprecated.
-
scheduleRefreshContactsTick
public void scheduleRefreshContactsTick(scala.concurrent.duration.FiniteDuration interval)
Deprecated.
-
postStop
public void postStop()
Deprecated.Description copied from interface:Actor
User overridable callback. Is called asynchronously after 'actor.stop()' is invoked. Empty default implementation.
-
receive
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive()
Deprecated.Description copied from interface:Actor
Scala API: This defines the initial actor behavior, it must return a partial function with the actor logic.
-
establishing
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> establishing()
Deprecated.
-
active
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> active(ActorRef receptionist)
Deprecated.
-
contactPointMessages
public scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> contactPointMessages()
Deprecated.
-
sendGetContacts
public void sendGetContacts()
Deprecated.
-
buffer
public void buffer(java.lang.Object msg)
Deprecated.
-
sendBuffered
public void sendBuffered(ActorRef receptionist)
Deprecated.
-
publishContactPoints
public void publishContactPoints()
Deprecated.
-
reestablish
public void reestablish()
Deprecated.
-
-