Package org.apache.pekko.actor
Class ActorSelection
java.lang.Object
org.apache.pekko.actor.ActorSelection
- All Implemented Interfaces:
Serializable
An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors,
allowing for broadcasting of messages to that section.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ActorRef
anchor()
Thepekko.actor.ActorPath
of the anchor actor.static ActorSelection
Construct an ActorSelection from the given string representing a path relative to the given target.static ActorSelection
Construct an ActorSelection from the given string representing a path relative to the given target.boolean
void
forward
(Object message, ActorContext context) Forwards the message and passes the original sender actor as the sender.int
hashCode()
protected abstract scala.collection.immutable.IndexedSeq<SelectionPathElement>
path()
String representation of the path elements, starting with "/" and separated with "/".resolveOne
(Duration timeout) Java API forresolveOne(org.apache.pekko.util.Timeout)
scala.concurrent.Future<ActorRef>
resolveOne
(Timeout timeout) Resolve theActorRef
matching this selection.scala.concurrent.Future<ActorRef>
resolveOne
(scala.concurrent.duration.FiniteDuration timeout) Resolve theActorRef
matching this selection.void
Sends the specified message to this ActorSelection, i.e.static ScalaActorSelection
toScala
(ActorSelection sel) String representation of the actor selection suitable for storage and recreation.toString()
-
Constructor Details
-
ActorSelection
public ActorSelection()
-
-
Method Details
-
toScala
-
apply
Construct an ActorSelection from the given string representing a path relative to the given target. This operation has to create all the matching magic, so it is preferable to cache its result if the intention is to send messages frequently. -
apply
Construct an ActorSelection from the given string representing a path relative to the given target. This operation has to create all the matching magic, so it is preferable to cache its result if the intention is to send messages frequently. -
anchor
-
path
-
tell
Sends the specified message to this ActorSelection, i.e. fire-and-forget semantics, including the sender reference if possible.Pass
ActorRef.noSender()
ornull
as sender if there is nobody to reply to -
forward
Forwards the message and passes the original sender actor as the sender.Works, no matter whether originally sent with tell/'!' or ask/'?'.
-
resolveOne
Resolve theActorRef
matching this selection. The result is returned as a Future that is completed with theActorRef
if such an actor exists. It is completed with failureActorNotFound
if no such actor exists or the identification didn't complete within the suppliedtimeout
.Under the hood it talks to the actor to verify its existence and acquire its
ActorRef
. -
resolveOne
public scala.concurrent.Future<ActorRef> resolveOne(scala.concurrent.duration.FiniteDuration timeout) Resolve theActorRef
matching this selection. The result is returned as a Future that is completed with theActorRef
if such an actor exists. It is completed with failureActorNotFound
if no such actor exists or the identification didn't complete within the suppliedtimeout
.Under the hood it talks to the actor to verify its existence and acquire its
ActorRef
. -
resolveOne
Java API forresolveOne(org.apache.pekko.util.Timeout)
Resolve the
ActorRef
matching this selection. The result is returned as a CompletionStage that is completed with theActorRef
if such an actor exists. It is completed with failureActorNotFound
if no such actor exists or the identification didn't complete within the suppliedtimeout
. -
toString
-
anchorPath
Thepekko.actor.ActorPath
of the anchor actor. -
pathString
String representation of the path elements, starting with "/" and separated with "/". -
toSerializationFormat
String representation of the actor selection suitable for storage and recreation. The output is similar to the URI fragment returned bypekko.actor.ActorPath#toSerializationFormat
.- Returns:
- URI fragment
-
equals
-
hashCode
public int hashCode()
-