public class SimulatedContext extends java.lang.Object implements CommandContextImpl
| Constructor and Description |
|---|
SimulatedContext(akka.actor.ActorRef self,
akka.actor.ActorRef sender,
akka.actor.ActorRef parent,
akka.actor.TimerScheduler timers,
akka.actor.ActorSystem system,
scala.Option<java.lang.String> dispatcherId) |
| Modifier and Type | Method and Description |
|---|---|
static scala.Option<java.lang.String> |
$lessinit$greater$default$6() |
akka.actor.ActorRef |
actorOf(akka.actor.Props props)
Create new actor as child of this actor and give it an automatically
generated name (currently similar to base64-encoded integer count,
reversed and with “$” prepended, may change in the future).
|
akka.actor.ActorRef |
actorOf(akka.actor.Props props,
java.lang.String name)
Create new actor as child of this actor with the given name, which must
not be null, empty or start with “$”.
|
akka.actor.ActorSelection |
actorSelection(akka.actor.ActorPath path)
Construct an
ActorSelection from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). |
akka.actor.ActorSelection |
actorSelection(java.lang.String path)
Construct an
ActorSelection from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). |
scala.Option<akka.actor.ActorRef> |
child(java.lang.String name)
Get the child with the given name if it exists.
|
scala.collection.immutable.Iterable<akka.actor.ActorRef> |
children()
Returns all supervised children; this method returns a view (i.e.
|
scala.concurrent.ExecutionContextExecutor |
dispatcher()
Returns the dispatcher (MessageDispatcher) that is used for this Actor.
|
scala.Option<java.lang.String> |
dispatcherId() |
java.util.Optional<akka.actor.ActorRef> |
findChild(java.lang.String name)
Get the child with the given name if it exists.
|
java.lang.Iterable<akka.actor.ActorRef> |
getChildren()
Returns all supervised children; this method returns a view (i.e.
|
scala.concurrent.ExecutionContextExecutor |
getDispatcher()
Returns the dispatcher (MessageDispatcher) that is used for this Actor.
|
akka.actor.ActorRef |
getParent()
Returns the supervising parent ActorRef.
|
scala.concurrent.duration.Duration |
getReceiveTimeout()
Gets the current receive timeout.
|
akka.actor.ActorRef |
getSelf()
Commands can be sent with the
ReplicatedEntity itself with this ActorRef, or it can be passed
in reply messages. |
akka.actor.ActorRef |
getSender()
Replies can be sent with this
sender() ActorRef an ActorRef that is passed in
the command. |
akka.actor.ActorSystem |
getSystem()
The system that the actor belongs to.
|
akka.actor.TimerScheduler |
getTimers()
Start and cancel timers via the enclosed
TimerScheduler. |
akka.actor.ActorRef |
parent()
Returns the supervising parent
ActorRef. |
scala.concurrent.duration.Duration |
receiveTimeout()
Gets the current receive timeout.
|
akka.actor.ActorRef |
self()
Commands can be sent with the
ReplicatedEntity itself with this ActorRef, or it can be passed
in reply messages. |
akka.actor.ActorRef |
sender()
Replies can be sent with this
sender() ActorRef an ActorRef that is passed in the command. |
void |
setReceiveTimeout(scala.concurrent.duration.Duration timeout)
Defines the inactivity timeout after which the sending of a
akka.actor.ReceiveTimeout message is triggered. |
void |
stop(akka.actor.ActorRef actor)
Stop the actor pointed to by the given
ActorRef; this is
an asynchronous operation, i.e. |
akka.actor.ActorSystem |
system()
The system that the actor belongs to.
|
akka.actor.TimerScheduler |
timers()
Start and cancel timers via the enclosed
TimerScheduler. |
akka.actor.ActorRef |
unwatch(akka.actor.ActorRef subject)
Unregisters this actor as Monitor for the provided ActorRef.
|
akka.actor.ActorRef |
watch(akka.actor.ActorRef subject)
Registers this actor as a Monitor for the provided ActorRef.
|
public SimulatedContext(akka.actor.ActorRef self,
akka.actor.ActorRef sender,
akka.actor.ActorRef parent,
akka.actor.TimerScheduler timers,
akka.actor.ActorSystem system,
scala.Option<java.lang.String> dispatcherId)
public static scala.Option<java.lang.String> $lessinit$greater$default$6()
public akka.actor.ActorRef self()
ReplicatedEntity.ActorContextReplicatedEntity itself with this ActorRef, or it can be passed
in reply messages.
WARNING: It is not possible to use self from the constructor of the ReplicatedEntity.
public akka.actor.ActorRef sender()
ReplicatedEntity.ActorContextsender() ActorRef an ActorRef that is passed in the command.
WARNING: It is not safe to use the sender() method directly in different thread (e.g. from a Future).
If you need to refer to the original sender in a Future, store the reference before the Future, like so
val replyTo = ctx.sender(); Future { replyTo ! "ok" } which is safe.
It IS safe to refer to the sender in the andThen effect callbacks however.
public akka.actor.ActorRef parent()
ReplicatedEntity.ActorContextActorRef.
When used with Cluster Sharding, this will be this entity's parent ShardRegion.
public akka.actor.TimerScheduler timers()
ReplicatedEntity.ActorContextTimerScheduler.
Message handlers for timer messages can be registered with ReplicatedEntity.CommandHandler.onTimer(scala.Function3<akka.persistence.multidc.scaladsl.ReplicatedEntity.CommandContext, State, M, akka.persistence.multidc.scaladsl.Effect<Event, State>>, scala.reflect.ClassTag<M>).public akka.actor.ActorSystem system()
ReplicatedEntity.ActorContextpublic scala.Option<java.lang.String> dispatcherId()
public scala.concurrent.duration.Duration receiveTimeout()
ReplicatedEntity.ActorContextakka.actor.ReceiveTimeout message.public void setReceiveTimeout(scala.concurrent.duration.Duration timeout)
ReplicatedEntity.ActorContextakka.actor.ReceiveTimeout message is triggered.
Message handlers for timer messages can be registered with SignalHandlerBuilder.onReceiveTimeout(akka.persistence.multidc.javadsl.SignalHandler<akka.actor.ReceiveTimeout, Event, State>).
1 millisecond is the minimum supported timeout.
Please note that the receive timeout might fire and enqueue the ReceiveTimeout message right after
another message was enqueued; hence it is '''not guaranteed''' that upon reception of the receive
timeout there must have been an idle period beforehand as configured via this method.
Once set, the receive timeout stays in effect (i.e. continues firing repeatedly after inactivity
periods). Pass in Duration.Undefined to switch off this feature.
Messages marked with NotInfluenceReceiveTimeout will not reset the timer. This can be useful when
ReceiveTimeout should be fired by external inactivity but not influenced by internal activity,
e.g. scheduled tick messages.
setReceiveTimeout in interface ReplicatedEntity.ActorContexttimeout - (undocumented)public scala.collection.immutable.Iterable<akka.actor.ActorRef> children()
ReplicatedEntity.ActorContextActorContext.child instead for performance reasons:
// DON'T DO THIS:
val badLookup = context.children find (_.path.name == "kid")
// should better be expressed as:
val goodLookup = context.child("kid")
public scala.Option<akka.actor.ActorRef> child(java.lang.String name)
ReplicatedEntity.ActorContextname - (undocumented)public scala.concurrent.ExecutionContextExecutor dispatcher()
ReplicatedEntity.ActorContextpublic akka.actor.ActorRef watch(akka.actor.ActorRef subject)
ReplicatedEntity.ActorContextTerminated(subject) message when watched
actor is terminated. Register handler for the Terminated message
with CommandHandlerBuilder.onTerminated
watch in interface ReplicatedEntity.ActorContextsubject - (undocumented)public akka.actor.ActorRef unwatch(akka.actor.ActorRef subject)
ReplicatedEntity.ActorContextunwatch in interface ReplicatedEntity.ActorContextsubject - (undocumented)public akka.actor.ActorRef getSelf()
ReplicatedEntity.ActorContextReplicatedEntity itself with this ActorRef, or it can be passed
in reply messages.
WARNING: It is not possible to use getSelf from the constructor of the ReplicatedEntity.
getSelf in interface ReplicatedEntity.ActorContextpublic akka.actor.ActorRef getSender()
ReplicatedEntity.ActorContextsender() ActorRef an ActorRef that is passed in
the command.getSender in interface ReplicatedEntity.ActorContextpublic scala.concurrent.duration.Duration getReceiveTimeout()
ReplicatedEntity.ActorContextakka.actor.ReceiveTimeout message.getReceiveTimeout in interface ReplicatedEntity.ActorContextpublic akka.actor.TimerScheduler getTimers()
ReplicatedEntity.ActorContextTimerScheduler.
Message handlers for timer messages can be registered with SignalHandlerBuilder.onTimer(java.lang.Class<M>, akka.persistence.multidc.javadsl.SignalHandler<M, Event, State>).getTimers in interface ReplicatedEntity.ActorContextpublic java.lang.Iterable<akka.actor.ActorRef> getChildren()
ReplicatedEntity.ActorContextchild instead for performance reasons:
val badLookup = context.children find (_.path.name == "kid")
// should better be expressed as:
val goodLookup = context.child("kid")
getChildren in interface ReplicatedEntity.ActorContextpublic java.util.Optional<akka.actor.ActorRef> findChild(java.lang.String name)
ReplicatedEntity.ActorContextfindChild in interface ReplicatedEntity.ActorContextname - (undocumented)public scala.concurrent.ExecutionContextExecutor getDispatcher()
ReplicatedEntity.ActorContextgetDispatcher in interface ReplicatedEntity.ActorContextpublic akka.actor.ActorSystem getSystem()
ReplicatedEntity.ActorContextgetSystem in interface ReplicatedEntity.ActorContextpublic akka.actor.ActorRef getParent()
ReplicatedEntity.ActorContextgetParent in interface ReplicatedEntity.ActorContextpublic akka.actor.ActorRef actorOf(akka.actor.Props props)
ReplicatedEntity.ActorContext
See Props for details on how to obtain a Props object.
actorOf in interface ReplicatedEntity.ActorContextprops - (undocumented)public akka.actor.ActorRef actorOf(akka.actor.Props props,
java.lang.String name)
ReplicatedEntity.ActorContextInvalidActorNameException is thrown.
See Props for details on how to obtain a Props object.
actorOf in interface ReplicatedEntity.ActorContextprops - (undocumented)name - (undocumented)public akka.actor.ActorSelection actorSelection(java.lang.String path)
ReplicatedEntity.ActorContextActorSelection from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). No attempt is made to verify the existence of any part of
the supplied path, it is recommended to send a message and gather the
replies in order to resolve the matching set of actors.actorSelection in interface ReplicatedEntity.ActorContextpath - (undocumented)public akka.actor.ActorSelection actorSelection(akka.actor.ActorPath path)
ReplicatedEntity.ActorContextActorSelection from the given path, which is
parsed for wildcards (these are replaced by regular expressions
internally). No attempt is made to verify the existence of any part of
the supplied path, it is recommended to send a message and gather the
replies in order to resolve the matching set of actors.actorSelection in interface ReplicatedEntity.ActorContextpath - (undocumented)public void stop(akka.actor.ActorRef actor)
ReplicatedEntity.ActorContextActorRef; this is
an asynchronous operation, i.e. involves a message send.
If this method is applied to the self reference from inside an Actor
then that Actor is guaranteed to not process any further messages after
this call; please note that the processing of the current message will
continue, this method does not immediately terminate this actor.stop in interface ReplicatedEntity.ActorContextactor - (undocumented)