package scaladsl
- Source
- package.scala
- Alphabetic
- By Inheritance
- scaladsl
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package adapter
Adapters between typed and classic actors and actor systems.
Adapters between typed and classic actors and actor systems. The underlying
ActorSystem
is the classic akka.actor.ActorSystem which runs Akka Typed akka.actor.typed.Behavior on an emulation layer. In this system typed and classic actors can coexist.Use these adapters with
import akka.actor.typed.scaladsl.adapter._
.Implicit extension methods are added to classic and typed
ActorSystem
,ActorContext
. Such methods make it possible to create typed child actor from classic parent actor, and the opposite classic child from typed parent.watch
is also supported in both directions.There is an implicit conversion from classic akka.actor.ActorRef to typed akka.actor.typed.ActorRef.
There are also converters (
toTyped
,toClassic
) from typed akka.actor.typed.ActorRef to classic akka.actor.ActorRef, and between classic akka.actor.ActorSystem and typed akka.actor.typed.ActorSystem.
Type Members
- abstract class AbstractBehavior[T] extends ExtensibleBehavior[T]
An actor
Behavior
can be implemented by extending this class and implement the abstract method AbstractBehavior#onMessage and optionally override AbstractBehavior#onSignal.An actor
Behavior
can be implemented by extending this class and implement the abstract method AbstractBehavior#onMessage and optionally override AbstractBehavior#onSignal. Mutable state can be defined as instance variables of the class.This is an Object-oriented style of defining a
Behavior
. A more functional style alternative is provided by the factory methods in Behaviors, for example Behaviors.receiveMessage.Instances of this behavior should be created via Behaviors.setup and the ActorContext should be passed as a constructor parameter from the factory function. This is important because a new instance should be created when restart supervision is used.
When switching
Behavior
to anotherAbstractBehavior
the originalActorContext
can be used as thecontext
parameter instead of wrapping in a newBehaviors.setup
, but it wouldn't be wrong to usecontext
fromBehaviors.setup
since that is the sameActorContext
instance.It must not be created with an
ActorContext
of another actor, such as the parent actor. Such mistake will be detected at runtime and throwIllegalStateException
when the first message is received.- See also
- trait ActorContext[T] extends TypedActorContext[T] with ClassicActorContextProvider
An Actor is given by the combination of a Behavior and a context in which this behavior is executed.
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:
- send a finite number of messages to other Actors it knows
- create a finite number of Actors
- designate the behavior for the next 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.
- Annotations
- @DoNotInherit()
- trait GroupRouter[T] extends Behavior[T]
Provides builder style configuration options for group routers
Provides builder style configuration options for group routers
Not for user extension. Use Routers#group to create
- Annotations
- @DoNotInherit()
- implicit final class LoggerOps extends AnyVal
Extension methods to org.slf4j.Logger that are useful because the Scala compiler can't select the right overloaded methods for some cases when using 2 template arguments and varargs (>= 3 arguments) with primitive types.
Extension methods to org.slf4j.Logger that are useful because the Scala compiler can't select the right overloaded methods for some cases when using 2 template arguments and varargs (>= 3 arguments) with primitive types.
Enable these extension methods with:
import akka.actor.typed.scaladsl.LoggerOps
or
import akka.actor.typed.scaladsl._
- trait PoolRouter[T] extends Behavior[T]
Provides builder style configuration options for pool routers
Provides builder style configuration options for pool routers
Not for user extension. Use Routers#pool to create
- Annotations
- @DoNotInherit()
- trait StashBuffer[T] extends AnyRef
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.
- Annotations
- @DoNotInherit()
- class StashOverflowException extends RuntimeException
Is thrown when the size of the stash exceeds the capacity of the stash buffer.
- trait TimerScheduler[T] extends AnyRef
Support for scheduled
self
messages in an actor.Support for scheduled
self
messages in an actor. It is used withBehaviors.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.Not for user extension.
- Annotations
- @DoNotInherit()
Value Members
- object AskPattern
The ask-pattern implements the initiator side of a request–reply protocol.
The ask-pattern implements the initiator side of a request–reply protocol.
See AskPattern.Askable.ask for details
- object Behaviors
Factories for akka.actor.typed.Behavior.
- object Routers