An Actor is given by the combination of a Behavior and a context in which this behavior is executed.
Mutable behavior can be implemented by extending this class and implement the abstract method MutableBehavior#onMessage and optionally override MutableBehavior#onSignal.
Mutable behavior can be implemented by extending this class and implement the abstract method MutableBehavior#onMessage and optionally override MutableBehavior#onSignal.
Instances of this behavior should be created via Behaviors#setup and if the ActorContext is needed it can be passed as a constructor parameter from the factory function.
A non thread safe mutable message buffer that can be used to buffer messages inside actors and then unstash them.
A non thread safe mutable message buffer that can be used to buffer messages inside actors and then unstash them.
The buffer can hold at most the given capacity
number of messages.
Not for user extension.
Is thrown when the size of the stash exceeds the capacity of the stash buffer.
Support for scheduled self
messages in an actor.
Support for scheduled self
messages in an actor.
It is used with Behaviors.withTimers
.
Timers are bound to the lifecycle of the actor that owns it,
and thus are cancelled automatically when it is restarted or stopped.
TimerScheduler
is not thread-safe, i.e. it must only be used within
the actor that owns it.
The ask-pattern implements the initiator side of a request–reply protocol.
The ask-pattern implements the initiator side of a request–reply protocol.
The ?
operator is pronounced as "ask".
See AskPattern.Askable.? for details
Factories for akka.actor.typed.Behavior.
Factories for akka.actor.typed.Behavior.
Scala API: Adapters between typed and untyped actors and actor systems.
Scala API: Adapters between typed and untyped actors and actor systems.
The underlying ActorSystem
is the untyped akka.actor.ActorSystem
which runs Akka Typed akka.actor.typed.Behavior on an emulation layer. In this
system typed and untyped actors can coexist.
Use these adapters with import akka.actor.typed.scaladsl.adapter._
.
Implicit extension methods are added to untyped and typed ActorSystem
,
ActorContext
. Such methods make it possible to create typed child actor
from untyped parent actor, and the opposite untyped child from typed parent.
watch
is also supported in both directions.
There is an implicit conversion from untyped akka.actor.ActorRef to typed akka.actor.typed.ActorRef.
There are also converters (toTyped
, toUntyped
) from typed
akka.actor.typed.ActorRef to untyped akka.actor.ActorRef, and between untyped
akka.actor.ActorSystem and typed akka.actor.typed.ActorSystem.
An Actor is given by the combination of a Behavior and a context in which this behavior is executed. As per the Actor Model an Actor can perform the following actions when processing a message:
In Akka the first capability is accessed by using the
!
ortell
method on an ActorRef, the second is provided by ActorContext#spawn and the third is implicit in the signature of Behavior in that the next behavior is always returned from the message processing logic.An
ActorContext
in addition provides access to the Actor’s own identity (“self
”), the ActorSystem it is part of, methods for querying the list of child Actors it created, access to Terminated and timed message scheduling.Not for user extension.