Class EntityRefImpl<M>
- java.lang.Object
-
- akka.cluster.sharding.typed.javadsl.EntityRef<M>
-
- akka.cluster.sharding.typed.internal.EntityRefImpl<M>
-
- All Implemented Interfaces:
InternalRecipientRef<M>
,RecipientRef<M>
,EntityRef<M>
public final class EntityRefImpl<M> extends EntityRef<M> implements EntityRef<M>, InternalRecipientRef<M>
Similar toakka.actor.typed.scaladsl.AskPattern.PromiseRef
but for an `EntityRef` target.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface akka.actor.typed.RecipientRef
RecipientRef.RecipientRefOps<T>, RecipientRef.RecipientRefOps$
-
-
Constructor Summary
Constructors Constructor Description EntityRefImpl(ActorRef shardRegion, java.lang.String entityId, EntityTypeKeyImpl<M> typeKey)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <U> java.util.concurrent.CompletionStage<U>
ask(Function<ActorRef<U>,M> message, Timeout timeout)
Allows to "ask" theEntityRef
for a reply.<U> scala.concurrent.Future<U>
ask(scala.Function1<ActorRef<U>,M> message, Timeout timeout)
Allows to "ask" theEntityRef
for a reply.boolean
isTerminated()
ActorRefProvider
provider()
Get a reference to the actor ref provider which created this ref.void
tell(M msg)
Send a message to the destination referenced by thisRecipientRef
using *at-most-once* messaging semantics.java.lang.String
toString()
-
-
-
Constructor Detail
-
EntityRefImpl
public EntityRefImpl(ActorRef shardRegion, java.lang.String entityId, EntityTypeKeyImpl<M> typeKey)
-
-
Method Detail
-
ask
public <U> scala.concurrent.Future<U> ask(scala.Function1<ActorRef<U>,M> message, Timeout timeout)
Description copied from interface:EntityRef
Allows to "ask" theEntityRef
for a reply. SeeAskPattern
for a complete write-up of this patternNote that if you are inside of an actor you should prefer
akka.actor.typed.scaladsl.ActorContext.ask
as that provides better safety.Example usage:
case class Request(msg: String, replyTo: ActorRef[Reply]) case class Reply(msg: String) implicit val timeout = Timeout(3.seconds) val target: EntityRef[Request] = ... val f: Future[Reply] = target.ask(Request("hello", _))
Please note that an implicit
Timeout
must be available to use this pattern.
-
ask
public <U> java.util.concurrent.CompletionStage<U> ask(Function<ActorRef<U>,M> message, Timeout timeout)
Description copied from class:EntityRef
Allows to "ask" theEntityRef
for a reply. SeeAskPattern
for a complete write-up of this patternNote that if you are inside of an actor you should prefer
akka.actor.typed.javadsl.ActorContext.ask
as that provides better safety.
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfaceInternalRecipientRef<M>
- Returns:
true
if the actor is locally known to be terminated,false
if alive or uncertain.
-
provider
public ActorRefProvider provider()
Description copied from interface:InternalRecipientRef
Get a reference to the actor ref provider which created this ref.- Specified by:
provider
in interfaceInternalRecipientRef<M>
- Returns:
- (undocumented)
-
tell
public void tell(M msg)
Description copied from interface:RecipientRef
Send a message to the destination referenced by thisRecipientRef
using *at-most-once* messaging semantics.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-