public final class PersistentEntityRef<Command> extends Object implements akka.actor.NoSerializationVerificationNeeded
PersistentEntity
using a PersistentEntityRef
. It is
retrieved with PersistentEntityRegistry.refFor(Class, String)
.Constructor and Description |
---|
PersistentEntityRef(String entityId,
akka.actor.ActorRef region,
akka.actor.ActorSystem system,
scala.concurrent.duration.FiniteDuration askTimeout)
Deprecated.
|
PersistentEntityRef(String entityId,
akka.actor.ActorRef region,
scala.concurrent.duration.FiniteDuration askTimeout) |
Modifier and Type | Method and Description |
---|---|
<Reply,Cmd extends Object & PersistentEntity.ReplyType<Reply>> |
ask(Cmd command)
Send the
command to the PersistentEntity . |
String |
entityId() |
String |
toString() |
PersistentEntityRef<Command> |
withAskTimeout(scala.concurrent.duration.FiniteDuration timeout)
The timeout for
ask(Object) . |
public PersistentEntityRef(String entityId, akka.actor.ActorRef region, scala.concurrent.duration.FiniteDuration askTimeout)
@Deprecated public PersistentEntityRef(String entityId, akka.actor.ActorRef region, akka.actor.ActorSystem system, scala.concurrent.duration.FiniteDuration askTimeout)
PersistentEntityRef(String, ActorRef, FiniteDuration)
instead.public String entityId()
public <Reply,Cmd extends Object & PersistentEntity.ReplyType<Reply>> CompletionStage<Reply> ask(Cmd command)
command
to the PersistentEntity
. The returned
CompletionStage
will be completed with the reply from the PersistentEntity
.
The type of the reply is defined by the command (see PersistentEntity.ReplyType
).
The CompletionStage
may also be completed with failure, sent by the
PersistentEntity
or a akka.pattern.AskTimeoutException
if there is no reply
within a timeout. The timeout can defined in configuration or overridden using withAskTimeout(FiniteDuration)
.
public PersistentEntityRef<Command> withAskTimeout(scala.concurrent.duration.FiniteDuration timeout)
ask(Object)
. The timeout is by default defined in configuration but it
can be adjusted for a specific PersistentEntityRef
using this method. Note that
this returns a new PersistentEntityRef
instance with the given timeout (
PersistentEntityRef
is immutable).