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.PromiseRefbut 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" theEntityReffor a reply.<U> scala.concurrent.Future<U>ask(scala.Function1<ActorRef<U>,M> message, Timeout timeout)Allows to "ask" theEntityReffor a reply.booleanisTerminated()ActorRefProviderprovider()Get a reference to the actor ref provider which created this ref.voidtell(M msg)Send a message to the destination referenced by thisRecipientRefusing *at-most-once* messaging semantics.java.lang.StringtoString()
-
-
-
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:EntityRefAllows to "ask" theEntityReffor a reply. SeeAskPatternfor a complete write-up of this patternNote that if you are inside of an actor you should prefer
akka.actor.typed.scaladsl.ActorContext.askas 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
Timeoutmust 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:EntityRefAllows to "ask" theEntityReffor a reply. SeeAskPatternfor a complete write-up of this patternNote that if you are inside of an actor you should prefer
akka.actor.typed.javadsl.ActorContext.askas that provides better safety.
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminatedin interfaceInternalRecipientRef<M>- Returns:
trueif the actor is locally known to be terminated,falseif alive or uncertain.
-
provider
public ActorRefProvider provider()
Description copied from interface:InternalRecipientRefGet a reference to the actor ref provider which created this ref.- Specified by:
providerin interfaceInternalRecipientRef<M>- Returns:
- (undocumented)
-
tell
public void tell(M msg)
Description copied from interface:RecipientRefSend a message to the destination referenced by thisRecipientRefusing *at-most-once* messaging semantics.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-