package typed
- Alphabetic
- Public
- Protected
Package Members
Type Members
- abstract class AbstractExtensionSetup[T <: Extension] extends ExtensionSetup[T]
Scala 2.11 API: Each extension typically provide a concrete
ExtensionSetup
that can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the extension.Scala 2.11 API: Each extension typically provide a concrete
ExtensionSetup
that can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the extension. Intended for tests that need to replace extension with stub/mock implementations. - trait ActorRef[-T] extends RecipientRef[T] with Comparable[ActorRef[_]] with Serializable
An ActorRef is the identity or address of an Actor instance.
An ActorRef is the identity or address of an Actor instance. It is valid only during the Actor’s lifetime and allows messages to be sent to that Actor instance. Sending a message to an Actor that has terminated before receiving the message will lead to that message being discarded; such messages are delivered to the DeadLetter channel of the akka.event.EventStream on a best effort basis (i.e. this delivery is not reliable).
Not for user extension
- Annotations
- @DoNotInherit()
- abstract class ActorRefResolver extends Extension
Serialization and deserialization of
ActorRef
.Serialization and deserialization of
ActorRef
.This class is not intended for user extension other than for test purposes (e.g. stub implementation). More methods may be added in the future and that may break such implementations.
- Annotations
- @DoNotInherit()
- final class ActorRefResolverSetup extends ExtensionSetup[ActorRefResolver]
Can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the ActorRefResolver extension.
Can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the ActorRefResolver extension. Intended for tests that need to replace extension with stub/mock implementations.
- abstract class ActorSystem[-T] extends ActorRef[T] with Extensions with ClassicActorSystemProvider
An ActorSystem is home to a hierarchy of Actors.
An ActorSystem is home to a hierarchy of Actors. It is created using ActorSystem#apply from a Behavior object that describes the root Actor of this hierarchy and which will create all other Actors beneath it. A system also implements the ActorRef type, and sending a message to the system directs that message to the root Actor.
Not for user extension.
- Annotations
- @DoNotInherit()
- abstract class ActorTags extends Props
Actor tags are used to logically group actors.
Actor tags are used to logically group actors. The tags are included in logging as markers Especially useful for logging from functional style actors and since those may not have a clear logger class.
Not for user extension.
- Annotations
- @DoNotInherit()
- sealed abstract class BackoffSupervisorStrategy extends SupervisorStrategy
Not for user extension
Not for user extension
- Annotations
- @DoNotInherit()
- abstract class Behavior[T] extends AnyRef
The behavior of an actor defines how it reacts to the messages that it receives.
The behavior of an actor defines how it reacts to the messages that it receives. The message may either be of the type that the Actor declares and which is part of the ActorRef signature, or it may be a system Signal that expresses a lifecycle event of either this actor or one of its child actors.
Behaviors can be formulated in a number of different ways, either by using the DSLs in akka.actor.typed.scaladsl.Behaviors and akka.actor.typed.javadsl.Behaviors or extending the abstract ExtensibleBehavior class.
Closing over ActorContext makes a Behavior immobile: it cannot be moved to another context and executed there, and therefore it cannot be replicated or forked either.
This base class is not meant to be extended by user code. If you do so, you may lose binary compatibility.
Not for user extension.
- Annotations
- @DoNotInherit()
- abstract class BehaviorInterceptor[Outer, Inner] extends AnyRef
A behavior interceptor allows for intercepting message and signal reception and perform arbitrary logic - transform, filter, send to a side channel etc.
A behavior interceptor allows for intercepting message and signal reception and perform arbitrary logic - transform, filter, send to a side channel etc. It is the core API for decoration of behaviors.
The
BehaviorInterceptor
API is considered a low level tool for building other features and shouldn't be used for "normal" application logic. Several built-in intercepting behaviors are provided through factories in the respectiveBehaviors
.If the interceptor does keep mutable state care must be taken to create a new instance from the factory function of
Behaviors.intercept
so that a new instance is created per spawned actor rather than shared among actor instance.- Outer
The outer message type – the type of messages the intercepting behavior will accept
- Inner
The inner message type - the type of message the wrapped behavior accepts
- See also
- abstract class BehaviorSignalInterceptor[Inner] extends BehaviorInterceptor[Inner, Inner]
A behavior interceptor allows for intercepting signals reception and perform arbitrary logic - transform, filter, send to a side channel etc.
A behavior interceptor allows for intercepting signals reception and perform arbitrary logic - transform, filter, send to a side channel etc.
The
BehaviorSignalInterceptor
API is considered a low level tool for building other features and shouldn't be used for "normal" application logic. Several built-in intercepting behaviors are provided through factories in the respectiveBehaviors
.If the interceptor does keep mutable state care must be taken to create a new instance from the factory function of
Behaviors.intercept
so that a new instance is created per spawned actor rather than shared among actor instance.- Inner
The inner message type - the type of message the wrapped behavior accepts
- See also
- final class ChildFailed extends Terminated
Child has failed due an uncaught exception
- final case class DeathPactException(ref: ActorRef[Nothing]) extends RuntimeException with Product with Serializable
Exception that an actor fails with if it does not handle a Terminated message.
- abstract class DispatcherSelector extends Props
Not for user extension.
Not for user extension.
- Annotations
- @DoNotInherit()
- abstract class Dispatchers extends AnyRef
An ActorSystem looks up all its thread pools via a Dispatchers instance.
- abstract class ExtensibleBehavior[T] extends Behavior[T]
Extension point for implementing custom behaviors in addition to the existing set of behaviors available through the DSLs in akka.actor.typed.scaladsl.Behaviors and akka.actor.typed.javadsl.Behaviors
Extension point for implementing custom behaviors in addition to the existing set of behaviors available through the DSLs in akka.actor.typed.scaladsl.Behaviors and akka.actor.typed.javadsl.Behaviors
Note that behaviors that keep an inner behavior, and intercepts messages for it should not be implemented as an extensible behavior but should instead use the BehaviorInterceptor
- trait Extension extends AnyRef
Marker trait/interface for extensions.
Marker trait/interface for extensions. An extension can be registered in the ActorSystem and is guaranteed to only have one instance per ActorSystem instance per ExtensionId. The extension internals must be thread safe. For mutable state it should be preferred to use an
Actor
rather than extensions as first choice.- See also
- abstract class ExtensionId[T <: Extension] extends AnyRef
Identifier and factory for an extension.
Identifier and factory for an extension. Is used to look up an extension from the
ActorSystem
, and possibly create an instance if no instance was already registered. The extension can also be listed in the actor system configuration to have it eagerly loaded and registered on actor system startup.*Scala API*
The
ExtensionId
for an extension written in Scala is best done by letting it be the companion object of the extension. If the extension will be used from Java special care needs to be taken to provide aget
method with the concrete extension type as return (as this will not be inferred correctly by the Java compiler with the default implementation)Example:
object MyExt extends ExtensionId[Ext] { override def createExtension(system: ActorSystem[_]): MyExt = new MyExt(system) // Java API: retrieve the extension instance for the given system. def get(system: ActorSystem[_]): MyExt = apply(system) } class MyExt(system: ActorSystem[_]) extends Extension { ... } // can be loaded eagerly on system startup through configuration // note that the name is the JVM/Java class name, with a dollar sign in the end // and not the Scala object name akka.actor.typed.extensions = ["com.example.MyExt$"] // Allows access like this from Scala MyExt().someMethodOnTheExtension() // and from Java MyExt.get(system).someMethodOnTheExtension()
*Java API*
To implement an extension in Java you should first create an
ExtensionId
singleton by implementing a static method calledgetInstance
, this is needed to be able to list the extension among theakka.actor.typed.extensions
in the configuration and have it loaded when the actor system starts up.public class MyExt extends AbstractExtensionId<MyExtImpl> { // single instance of the identifier private final static MyExt instance = new MyExt(); // protect against other instances than the singleton private MyExt() {} // This static method singleton accessor is needed to be able to enable the extension through config when // implementing extensions in Java. public static MyExt getInstance() { return instance; } public MyExtImpl createExtension(ActorSystem<?> system) { return new MyExtImpl(); } // convenience accessor public static MyExtImpl get(ActorSystem<?> system) { return instance.apply(system); } } public class MyExtImpl implements Extension { ... } // can be loaded eagerly on system startup through configuration akka.actor.typed.extensions = ["com.example.MyExt"] // Allows access like this from Scala MyExt.someMethodOnTheExtension() // and from Java MyExt.get(system).someMethodOnTheExtension()
For testing purposes extensions typically provide a concrete ExtensionSetup that can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the extension.
- T
The concrete extension type
- See also
- abstract class ExtensionSetup[T <: Extension] extends Setup
Each extension typically provide a concrete
ExtensionSetup
that can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the extension.Each extension typically provide a concrete
ExtensionSetup
that can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the extension. Intended for tests that need to replace extension with stub/mock implementations. - trait Extensions extends AnyRef
API for registering and looking up extensions.
API for registering and looking up extensions.
Not for user extension.
- Annotations
- @DoNotInherit()
- sealed abstract class LogOptions extends AnyRef
Logging options when using
Behaviors.logMessages
.Logging options when using
Behaviors.logMessages
.- Annotations
- @DoNotInherit()
- abstract class MailboxSelector extends Props
Not for user extension.
Not for user extension.
- Annotations
- @DoNotInherit()
- final case class MessageAdaptionFailure(exception: Throwable) extends Signal with Product with Serializable
Signal passed to the actor when a message adapter has thrown an exception adapting an incoming message.
Signal passed to the actor when a message adapter has thrown an exception adapting an incoming message. Default signal handlers will re-throw the exception so that such failures are handled by supervision.
- sealed abstract class PostStop extends Signal
Lifecycle signal that is fired after this actor and all its child actors (transitively) have terminated.
Lifecycle signal that is fired after this actor and all its child actors (transitively) have terminated. The Terminated signal is only sent to registered watchers after this signal has been processed.
- sealed abstract class PreRestart extends Signal
Lifecycle signal that is fired upon restart of the Actor before replacing the behavior with the fresh one (i.e.
Lifecycle signal that is fired upon restart of the Actor before replacing the behavior with the fresh one (i.e. this signal is received within the behavior that failed).
- abstract class Props extends Product with Serializable
Data structure for describing an actor’s props details like which executor to run it on.
Data structure for describing an actor’s props details like which executor to run it on. For each type of setting (e.g. DispatcherSelector) the FIRST occurrence is used when creating the actor; this means that adding configuration using the "with" methods overrides what was configured previously.
Deliberately not sealed in order to emphasize future extensibility by the framework—this is not intended to be extended by user code.
Not for user extension.
- Annotations
- @DoNotInherit()
- trait RecipientRef[-T] extends AnyRef
FIXME doc - not serializable - not watchable
- sealed abstract class RestartSupervisorStrategy extends SupervisorStrategy
Not for user extension
Not for user extension
- Annotations
- @DoNotInherit()
- trait Scheduler extends AnyRef
The ActorSystem facility for scheduling tasks.
The ActorSystem facility for scheduling tasks.
For scheduling within actors
Behaviors.withTimers
should be preferred.Not for user extension
- Annotations
- @DoNotInherit()
- final class Settings extends AnyRef
The configuration settings that were parsed from the config by an ActorSystem.
The configuration settings that were parsed from the config by an ActorSystem. This class is immutable.
- trait Signal extends AnyRef
System signals are notifications that are generated by the system and delivered to the Actor behavior in a reliable fashion (i.e.
System signals are notifications that are generated by the system and delivered to the Actor behavior in a reliable fashion (i.e. they are guaranteed to arrive in contrast to the at-most-once semantics of normal Actor messages).
- sealed abstract class SupervisorStrategy extends AnyRef
Not for user extension
Not for user extension
- Annotations
- @DoNotInherit()
- sealed class Terminated extends Signal
Lifecycle signal that is fired when an Actor that was watched has terminated.
Lifecycle signal that is fired when an Actor that was watched has terminated. Watching is performed by invoking the akka.actor.typed.scaladsl.ActorContext.watch. The DeathWatch service is idempotent, meaning that registering twice has the same effect as registering once. Registration does not need to happen before the Actor terminates, a notification is guaranteed to arrive after both registration and termination have occurred. This message is also sent when the watched actor is on a node that has been removed from the cluster when using Akka Cluster.
- Annotations
- @DoNotInherit()
- trait TypedActorContext[T] extends AnyRef
This trait is not meant to be extended by user code.
This trait is not meant to be extended by user code. If you do so, you may lose binary compatibility.
Not for user extension.
- Annotations
- @DoNotInherit()
Value Members
- object ActorRef extends Serializable
- object ActorRefResolver extends ExtensionId[ActorRefResolver]
- object ActorRefResolverSetup
- object ActorSystem extends Serializable
- object ActorTags extends Serializable
- object Behavior
- object BehaviorInterceptor
- object ChildFailed
- object DispatcherSelector extends Serializable
Factories for DispatcherSelectors which describe which thread pool shall be used to run the actor to which this configuration is applied.
Factories for DispatcherSelectors which describe which thread pool shall be used to run the actor to which this configuration is applied. See the individual factory methods for details on the options.
The default configuration if none of these options are present is to run the actor on the default ActorSystem executor.
- object Dispatchers
- object LogOptions
Factories for log options
- object MailboxSelector extends Serializable
- case object PostStop extends PostStop with Product with Serializable
Lifecycle signal that is fired after this actor and all its child actors (transitively) have terminated.
Lifecycle signal that is fired after this actor and all its child actors (transitively) have terminated. The Terminated signal is only sent to registered watchers after this signal has been processed.
- case object PreRestart extends PreRestart with Product with Serializable
- object Props extends Serializable
- object RecipientRef
- object SpawnProtocol
A message protocol for actors that support spawning a child actor when receiving a SpawnProtocol#Spawn message and sending back the ActorRef of the child actor.
A message protocol for actors that support spawning a child actor when receiving a SpawnProtocol#Spawn message and sending back the ActorRef of the child actor. Create instances through the SpawnProtocol#apply or SpawnProtocol#create factory methods.
The typical usage of this is to use it as the guardian actor of the ActorSystem, possibly combined with
Behaviors.setup
to starts some initial tasks or actors. Child actors can then be started from the outside by telling or asking SpawnProtocol#Spawn to the actor reference of the system. When usingask
this is similar to how akka.actor.ActorSystem#actorOf can be used in classic actors with the difference that aFuture
/CompletionStage
of theActorRef
is returned.Stopping children is done through specific support in the protocol of the children, or stopping the entire spawn protocol actor.
- object SupervisorStrategy
- object Terminated