public final class PersistentEntityRef<Command>
extends Object
implements akka.actor.NoSerializationVerificationNeeded
PersistentEntity using a
PersistentEntityRef. It is retrieved with PersistentEntityRegistry.refFor(java.lang.Class<? extends com.lightbend.lagom.javadsl.persistence.PersistentEntity<C, ?, ?>>, java.lang.String).| Constructor and Description |
|---|
PersistentEntityRef(String entityId,
akka.actor.ActorRef region,
akka.actor.ActorSystem system,
scala.concurrent.duration.FiniteDuration askTimeout) |
| Modifier and Type | Method and Description |
|---|---|
<Reply,Cmd extends Command> |
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(Cmd). |
public PersistentEntityRef(String entityId,
akka.actor.ActorRef region,
akka.actor.ActorSystem system,
scala.concurrent.duration.FiniteDuration askTimeout)
public String entityId()
public <Reply,Cmd extends Command> java.util.concurrent.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(scala.concurrent.duration.FiniteDuration).
public PersistentEntityRef<Command> withAskTimeout(scala.concurrent.duration.FiniteDuration timeout)
ask(Cmd). 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).public String toString()
toString in class Object