Package org.apache.pekko.actor.typed
Interface ActorRef<T>
- All Superinterfaces:
Comparable<ActorRef<?>>,RecipientRef<T>,Serializable
- All Known Subinterfaces:
ActorRefImpl<T>
- All Known Implementing Classes:
ActorSystem
An ActorRef is the identity or address of an Actor instance. It is valid
only during the Actor’s lifetime and allows messages to be sent to that
Actor instance. Sending a message to an Actor that has terminated before
receiving the message will lead to that message being discarded; such
messages are delivered to the
DeadLetter channel of the
pekko.event.EventStream on a best effort basis
(i.e. this delivery is not reliable).
Not for user extension
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classstatic classNested classes/interfaces inherited from interface org.apache.pekko.actor.typed.RecipientRef
RecipientRef.RecipientRefOps<T>, RecipientRef.RecipientRefOps$ -
Method Summary
Modifier and TypeMethodDescriptionnarrow()Narrow the type of thisActorRef, which is always a safe operation.path()The hierarchical path name of the referenced Actor.voidSend a message to the Actor referenced by this ActorRef using *at-most-once* messaging semantics.<U> ActorRef<U>Unsafe utility method for widening the type accepted by this ActorRef; provided to avoid having to useasInstanceOfon the full reference type, which would unfortunately also work on non-ActorRefs.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
tell
Send a message to the Actor referenced by this ActorRef using *at-most-once* messaging semantics.- Specified by:
tellin interfaceRecipientRef<T>
-
narrow
Narrow the type of thisActorRef, which is always a safe operation. -
unsafeUpcast
Unsafe utility method for widening the type accepted by this ActorRef; provided to avoid having to useasInstanceOfon the full reference type, which would unfortunately also work on non-ActorRefs. Use it with caution,it may cause aClassCastExceptionwhen you send a message to the widenedActorRef[U]. -
path
ActorPath path()The hierarchical path name of the referenced Actor. The lifecycle of the ActorRef is fully contained within the lifecycle of thepekko.actor.ActorPathand more than one Actor instance can exist with the same path at different points in time, but not concurrently. -
writeReplace
- Throws:
ObjectStreamException
-