Package

akka

actor

Permalink

package actor

Source
package.scala
Linear Supertypes
Content Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. actor
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. abstract class AbstractActor extends Actor

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Actor base class that should be extended to create Java actors that use lambdas.

    Example:

    public class MyActor extends AbstractActor {
      int count = 0;
    
      public MyActor() {
        receive(ReceiveBuilder.
          match(Double.class, d -> {
            sender().tell(d.isNaN() ? 0 : d, self());
          }).
          match(Integer.class, i -> {
            sender().tell(i * 10, self());
          }).
          match(String.class, s -> s.startsWith("foo"), s -> {
            sender().tell(s.toUpperCase(), self());
          }).build()
        );
      }
    }
    

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

    Annotations
    @ApiMayChange()
  2. trait AbstractActorContext extends ActorContext

    Permalink

    AbstractActorContext is the AbstractActor equivalent of ActorContext, containing the Java API

  3. abstract class AbstractActorWithStash extends AbstractActor with Stash

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Actor base class that should be extended to create an actor with a stash.

    The stash enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior.

    Example:

    public class MyActorWithStash extends AbstractActorWithStash {
      int count = 0;
    
      public MyActorWithStash() {
        receive(ReceiveBuilder. match(String.class, s -> {
          if (count < 0) {
            sender().tell(new Integer(s.length()), self());
          } else if (count == 2) {
            count = -1;
            unstashAll();
          } else {
            count += 1;
            stash();
          }}).build()
        );
      }
    }
    
    Note that the subclasses of AbstractActorWithStash by default request a Deque based mailbox since this class implements the RequiresMessageQueue<DequeBasedMessageQueueSemantics> marker interface. You can override the default mailbox provided when DequeBasedMessageQueueSemantics are requested via config:
      akka.actor.mailbox.requirements {
        "akka.dispatch.BoundedDequeBasedMessageQueueSemantics" = your-custom-mailbox
      }
    
    Alternatively, you can add your own requirement marker to the actor and configure a mailbox type to be used for your marker.

    For a Stash based actor that enforces unbounded deques see akka.actor.AbstractActorWithUnboundedStash. There is also an unrestricted version akka.actor.AbstractActorWithUnrestrictedStash that does not enforce the mailbox type.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  4. abstract class AbstractActorWithUnboundedStash extends AbstractActor with UnboundedStash

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Actor base class with Stash that enforces an unbounded deque for the actor. The proper mailbox has to be configured manually, and the mailbox should extend the akka.dispatch.DequeBasedMessageQueueSemantics marker trait. See akka.actor.AbstractActorWithStash for details on how Stash works.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  5. abstract class AbstractActorWithUnrestrictedStash extends AbstractActor with UnrestrictedStash

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Actor base class with Stash that does not enforce any mailbox type. The mailbox of the actor has to be configured manually. See akka.actor.AbstractActorWithStash for details on how Stash works.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  6. abstract class AbstractExtensionId[T <: Extension] extends ExtensionId[T]

    Permalink

    Java API for ExtensionId

  7. abstract class AbstractFSM[S, D] extends FSM[S, D]

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Finite State Machine actor abstract base class.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  8. abstract class AbstractFSMWithStash[S, D] extends AbstractFSM[S, D] with Stash

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Finite State Machine actor abstract base class with Stash support.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  9. abstract class AbstractLoggingActor extends AbstractActor with ActorLogging

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Actor base class that mixes in logging into the Actor.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  10. abstract class AbstractLoggingFSM[S, D] extends AbstractFSM[S, D] with LoggingFSM[S, D]

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    Finite State Machine actor abstract base class.

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  11. abstract class AbstractScheduler extends AbstractSchedulerBase

    Permalink
  12. abstract class AbstractSchedulerBase extends Scheduler

    Permalink
  13. trait Actor extends AnyRef

    Permalink

    Actor base trait that should be extended by or mixed to create an Actor with the semantics of the 'Actor Model': http://en.wikipedia.org/wiki/Actor_model

    Actor base trait that should be extended by or mixed to create an Actor with the semantics of the 'Actor Model': http://en.wikipedia.org/wiki/Actor_model

    An actor has a well-defined (non-cyclic) life-cycle.

    • RUNNING (created and started actor) - can receive messages
    • SHUTDOWN (when 'stop' is invoked) - can't do anything

    The Actor's own akka.actor.ActorRef is available as self, the current message’s sender as sender() and the akka.actor.ActorContext as context. The only abstract method is receive which shall return the initial behavior of the actor as a partial function (behavior can be changed using context.become and context.unbecome).

    This is the Scala API (hence the Scala code below), for the Java API see akka.actor.UntypedActor.

    class ExampleActor extends Actor {
    
      override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
        case _: ArithmeticException      => Resume
        case _: NullPointerException     => Restart
        case _: IllegalArgumentException => Stop
        case _: Exception                => Escalate
      }
    
      def receive = {
                                         // directly calculated reply
        case Request(r)               => sender() ! calculate(r)
    
                                         // just to demonstrate how to stop yourself
        case Shutdown                 => context.stop(self)
    
                                         // error kernel with child replying directly to 'sender()'
        case Dangerous(r)             => context.actorOf(Props[ReplyToOriginWorker]).tell(PerformWork(r), sender())
    
                                         // error kernel with reply going through us
        case OtherJob(r)              => context.actorOf(Props[ReplyToMeWorker]) ! JobRequest(r, sender())
        case JobReply(result, orig_s) => orig_s ! result
      }
    }

    The last line demonstrates the essence of the error kernel design: spawn one-off actors which terminate after doing their job, pass on sender() to allow direct reply if that is what makes sense, or round-trip the sender as shown with the fictitious JobRequest/JobReply message pair.

    If you don’t like writing context you can always import context._ to get direct access to actorOf, stop etc. This is not default in order to keep the name-space clean.

  14. trait ActorContext extends ActorRefFactory

    Permalink

    The actor context - the view of the actor cell from the actor.

    The actor context - the view of the actor cell from the actor. Exposes contextual information for the actor and the current message.

    There are several possibilities for creating actors (see akka.actor.Props for details on props):

    // Java or Scala
    context.actorOf(props, "name")
    context.actorOf(props)
    
    // Scala
    context.actorOf(Props[MyActor])
    context.actorOf(Props(classOf[MyActor], arg1, arg2), "name")
    
    // Java
    getContext().actorOf(Props.create(MyActor.class));
    getContext().actorOf(Props.create(MyActor.class, arg1, arg2), "name");

    Where no name is given explicitly, one will be automatically generated.

  15. final case class ActorIdentity(correlationId: Any, ref: Option[ActorRef]) extends Product with Serializable

    Permalink

    Reply to akka.actor.Identify.

    Reply to akka.actor.Identify. Contains Some(ref) with the ActorRef of the actor replying to the request or None if no actor matched the request. The correlationId is taken from the messageId in the Identify message.

    Annotations
    @SerialVersionUID()
  16. class ActorInitializationException extends AkkaException

    Permalink

    An ActorInitializationException is thrown when the initialization logic for an Actor fails.

    An ActorInitializationException is thrown when the initialization logic for an Actor fails.

    There is an extractor which works for ActorInitializationException and its subtypes:

    ex match {
      case ActorInitializationException(actor, message, cause) => ...
    }
    Annotations
    @SerialVersionUID()
  17. class ActorInterruptedException extends AkkaException

    Permalink

    When an InterruptedException is thrown inside an Actor, it is wrapped as an ActorInterruptedException as to avoid cascading interrupts to other threads than the originally interrupted one.

    When an InterruptedException is thrown inside an Actor, it is wrapped as an ActorInterruptedException as to avoid cascading interrupts to other threads than the originally interrupted one.

    Annotations
    @SerialVersionUID()
  18. final case class ActorKilledException extends AkkaException with NoStackTrace with Product with Serializable

    Permalink

    ActorKilledException is thrown when an Actor receives the akka.actor.Kill message

    ActorKilledException is thrown when an Actor receives the akka.actor.Kill message

    Annotations
    @SerialVersionUID()
  19. trait ActorLogging extends AnyRef

    Permalink

    Scala API: Mix in ActorLogging into your Actor to easily obtain a reference to a logger, which is available under the name "log".

    Scala API: Mix in ActorLogging into your Actor to easily obtain a reference to a logger, which is available under the name "log".

    class MyActor extends Actor with ActorLogging {
      def receive = {
        case "pigdog" => log.info("We've got yet another pigdog on our hands")
      }
    }
  20. final case class ActorNotFound(selection: ActorSelection) extends RuntimeException with Product with Serializable

    Permalink

    When ActorSelection#resolveOne can't identify the actor the Future is completed with this failure.

    When ActorSelection#resolveOne can't identify the actor the Future is completed with this failure.

    Annotations
    @SerialVersionUID()
  21. sealed trait ActorPath extends Comparable[ActorPath] with Serializable

    Permalink

    Actor path is a unique path to an actor that shows the creation path up through the actor tree to the root actor.

    Actor path is a unique path to an actor that shows the creation path up through the actor tree to the root actor.

    ActorPath defines a natural ordering (so that ActorRefs can be put into collections with this requirement); this ordering is intended to be as fast as possible, which owing to the bottom-up recursive nature of ActorPath is sorted by path elements FROM RIGHT TO LEFT, where RootActorPath > ChildActorPath in case the number of elements is different.

    Two actor paths are compared equal when they have the same name and parent elements, including the root address information. That does not necessarily mean that they point to the same incarnation of the actor if the actor is re-created with the same path. In other words, in contrast to how actor references are compared the unique id of the actor is not taken into account when comparing actor paths.

    Annotations
    @SerialVersionUID()
  22. abstract class ActorRef extends Comparable[ActorRef] with Serializable

    Permalink

    Immutable and serializable handle to an actor, which may or may not reside on the local host or inside the same akka.actor.ActorSystem.

    Immutable and serializable handle to an actor, which may or may not reside on the local host or inside the same akka.actor.ActorSystem. An ActorRef can be obtained from an akka.actor.ActorRefFactory, an interface which is implemented by ActorSystem and akka.actor.ActorContext. This means actors can be created top-level in the ActorSystem or as children of an existing actor, but only from within that actor.

    ActorRefs can be freely shared among actors by message passing. Message passing conversely is their only purpose, as demonstrated in the following examples:

    Scala:

    import akka.pattern.ask
    import scala.concurrent.Await
    
    class ExampleActor extends Actor {
      val other = context.actorOf(Props[OtherActor], "childName") // will be destroyed and re-created upon restart by default
    
      def receive {
        case Request1(msg) => other ! refine(msg)     // uses this actor as sender reference, reply goes to us
        case Request2(msg) => other.tell(msg, sender()) // forward sender reference, enabling direct reply
        case Request3(msg) =>
          implicit val timeout = Timeout(5.seconds)
          (other ? msg) pipeTo sender()
          // the ask call will get a future from other's reply
          // when the future is complete, send its value to the original sender
      }
    }

    Java:

    import static akka.pattern.Patterns.ask;
    import static akka.pattern.Patterns.pipe;
    
    public class ExampleActor extends UntypedActor {
      // this child will be destroyed and re-created upon restart by default
      final ActorRef other = getContext().actorOf(Props.create(OtherActor.class), "childName");
    
      @Override
      public void onReceive(Object o) {
        if (o instanceof Request1) {
          Msg msg = ((Request1) o).getMsg();
          other.tell(msg, getSelf()); // uses this actor as sender reference, reply goes to us
    
        } else if (o instanceof Request2) {
          Msg msg = ((Request2) o).getMsg();
          other.tell(msg, getSender()); // forward sender reference, enabling direct reply
    
        } else if (o instanceof Request3) {
          Msg msg = ((Request3) o).getMsg();
          pipe(ask(other, msg, 5000), context().dispatcher()).to(getSender());
          // the ask call will get a future from other's reply
          // when the future is complete, send its value to the original sender
    
        } else {
          unhandled(o);
        }
      }
    }

    ActorRef does not have a method for terminating the actor it points to, use akka.actor.ActorRefFactory.stop(ref), or send a akka.actor.PoisonPill, for this purpose.

    Two actor references are compared equal when they have the same path and point to the same actor incarnation. A reference pointing to a terminated actor doesn't compare equal to a reference pointing to another (re-created) actor with the same path.

    If you need to keep track of actor references in a collection and do not care about the exact actor incarnation you can use the ActorPath as key because the unique id of the actor is not taken into account when comparing actor paths.

  23. trait ActorRefFactory extends AnyRef

    Permalink

    Interface implemented by ActorSystem and ActorContext, the only two places from which you can get fresh actors.

    Interface implemented by ActorSystem and ActorContext, the only two places from which you can get fresh actors.

    Annotations
    @implicitNotFound( ... )
  24. trait ActorRefProvider extends AnyRef

    Permalink

    Interface for all ActorRef providers to implement.

  25. abstract class ActorSelection extends Serializable

    Permalink

    An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors, allowing for broadcasting of messages to that section.

    An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors, allowing for broadcasting of messages to that section.

    Annotations
    @SerialVersionUID()
  26. abstract class ActorSystem extends ActorRefFactory

    Permalink

    An actor system is a hierarchical group of actors which share common configuration, e.g.

    An actor system is a hierarchical group of actors which share common configuration, e.g. dispatchers, deployments, remote capabilities and addresses. It is also the entry point for creating or looking up actors.

    There are several possibilities for creating actors (see akka.actor.Props for details on props):

    // Java or Scala
    system.actorOf(props, "name")
    system.actorOf(props)
    
    // Scala
    system.actorOf(Props[MyActor], "name")
    system.actorOf(Props(classOf[MyActor], arg1, arg2), "name")
    
    // Java
    system.actorOf(Props.create(MyActor.class), "name");
    system.actorOf(Props.create(MyActor.class, arg1, arg2), "name");

    Where no name is given explicitly, one will be automatically generated.

    Important Notice:

    This class is not meant to be extended by user code. If you want to actually roll your own Akka, it will probably be better to look into extending akka.actor.ExtendedActorSystem instead, but beware that you are completely on your own in that case!

  27. final case class Address extends Product with Serializable

    Permalink

    The address specifies the physical location under which an Actor can be reached.

    The address specifies the physical location under which an Actor can be reached. Examples are local addresses, identified by the ActorSystem’s name, and remote addresses, identified by protocol, host and port.

    This class is final to allow use as a case class (copy method etc.); if for example a remote transport would want to associate additional information with an address, then this must be done externally.

    Annotations
    @SerialVersionUID()
  28. sealed trait AllDeadLetters extends AnyRef

    Permalink

    Subscribe to this class to be notified about all DeadLetters (also the suppressed ones).

  29. case class AllForOneStrategy(maxNrOfRetries: Int = 1, withinTimeRange: Duration = Duration.Inf, loggingEnabled: Boolean = true)(decider: Decider) extends SupervisorStrategy with Product with Serializable

    Permalink

    Applies the fault handling Directive (Resume, Restart, Stop) specified in the Decider to all children when one fails, as opposed to akka.actor.OneForOneStrategy that applies it only to the child actor that failed.

    Applies the fault handling Directive (Resume, Restart, Stop) specified in the Decider to all children when one fails, as opposed to akka.actor.OneForOneStrategy that applies it only to the child actor that failed.

    maxNrOfRetries

    the number of times a child actor is allowed to be restarted, negative value means no limit, if the limit is exceeded the child actor is stopped

    withinTimeRange

    duration of the time window for maxNrOfRetries, Duration.Inf means no window

    loggingEnabled

    the strategy logs the failure if this is enabled (true), by default it is enabled

    decider

    mapping from Throwable to akka.actor.SupervisorStrategy.Directive, you can also use a scala.collection.immutable.Seq of Throwables which maps the given Throwables to restarts, otherwise escalates.

  30. final class BootstrapSetup extends Setup

    Permalink

    Core bootstrap settings of the actor system, create using one of the factories in BootstrapSetup, constructor is *Internal API*.

  31. trait Cancellable extends AnyRef

    Permalink

    Signifies something that can be cancelled There is no strict guarantee that the implementation is thread-safe, but it should be good practice to make it so.

  32. final class ChildActorPath extends ActorPath

    Permalink
    Annotations
    @SerialVersionUID()
  33. final case class ChildRestartStats(child: ActorRef, maxNrOfRetriesCount: Int = 0, restartTimeWindowStartNanos: Long = 0L) extends ChildStats with Product with Serializable

    Permalink

    ChildRestartStats is the statistics kept by every parent Actor for every child Actor and is used for SupervisorStrategies to know how to deal with problems that occur for the children.

  34. final case class ContextualTypedActorFactory(typedActor: TypedActorExtension, actorFactory: ActorContext) extends TypedActorFactory with Product with Serializable

    Permalink

    ContextualTypedActorFactory allows TypedActors to create children, effectively forming the same Actor Supervision Hierarchies as normal Actors can.

  35. final class CoordinatedShutdown extends Extension

    Permalink
  36. final case class DeadLetter(message: Any, sender: ActorRef, recipient: ActorRef) extends AllDeadLetters with Product with Serializable

    Permalink

    When a message is sent to an Actor that is terminated before receiving the message, it will be sent as a DeadLetter to the ActorSystem's EventStream

    When a message is sent to an Actor that is terminated before receiving the message, it will be sent as a DeadLetter to the ActorSystem's EventStream

    Annotations
    @SerialVersionUID()
  37. trait DeadLetterSuppression extends AnyRef

    Permalink

    Use with caution: Messages extending this trait will not be logged by the default dead-letters listener.

    Use with caution: Messages extending this trait will not be logged by the default dead-letters listener. Instead they will be wrapped as SuppressedDeadLetter and may be subscribed for explicitly.

  38. final case class DeathPactException extends AkkaException with NoStackTrace with Product with Serializable

    Permalink

    A DeathPactException is thrown by an Actor that receives a Terminated(someActor) message that it doesn't handle itself, effectively crashing the Actor and escalating to the supervisor.

    A DeathPactException is thrown by an Actor that receives a Terminated(someActor) message that it doesn't handle itself, effectively crashing the Actor and escalating to the supervisor.

    Annotations
    @SerialVersionUID()
  39. final class DefaultSupervisorStrategy extends SupervisorStrategyConfigurator

    Permalink
  40. final case class Deploy(path: String = "", config: Config = ConfigFactory.empty, routerConfig: RouterConfig = NoRouter, scope: Scope = NoScopeGiven, dispatcher: String = Deploy.NoDispatcherGiven, mailbox: String = Deploy.NoMailboxGiven) extends Product with Serializable

    Permalink

    This class represents deployment configuration for a given actor path.

    This class represents deployment configuration for a given actor path. It is marked final in order to guarantee stable merge semantics (i.e. what overrides what in case multiple configuration sources are available) and is fully extensible via its Scope argument, and by the fact that an arbitrary Config section can be passed along with it (which will be merged when merging two Deploys).

    The path field is used only when inserting the Deploy into a deployer and not needed when just doing deploy-as-you-go:

    val remoteProps = someProps.withDeploy(Deploy(scope = RemoteScope("someOtherNodeName")))
    Annotations
    @SerialVersionUID()
  41. trait DiagnosticActorLogging extends Actor

    Permalink

    Scala API: Mix in DiagnosticActorLogging into your Actor to easily obtain a reference to a logger with MDC support, which is available under the name "log".

    Scala API: Mix in DiagnosticActorLogging into your Actor to easily obtain a reference to a logger with MDC support, which is available under the name "log". In the example bellow "the one who knocks" will be available under the key "iam" for using it in the logback pattern.

    class MyActor extends Actor with DiagnosticActorLogging {
    
      override def mdc(currentMessage: Any): MDC = {
        Map("iam", "the one who knocks")
      }
    
      def receive = {
        case "pigdog" => log.info("We've got yet another pigdog on our hands")
      }
    }
  42. abstract class DynamicAccess extends AnyRef

    Permalink

    The DynamicAccess implementation is the class which is used for loading all configurable parts of an actor system (the akka.actor.ReflectiveDynamicAccess is the default implementation).

    The DynamicAccess implementation is the class which is used for loading all configurable parts of an actor system (the akka.actor.ReflectiveDynamicAccess is the default implementation).

    This is an internal facility and users are not expected to encounter it unless they are extending Akka in ways which go beyond simple Extensions.

  43. abstract class ExtendedActorSystem extends ActorSystem

    Permalink

    More powerful interface to the actor system’s implementation which is presented to extensions (see akka.actor.Extension).

    More powerful interface to the actor system’s implementation which is presented to extensions (see akka.actor.Extension).

    Important Notice:

    This class is not meant to be extended by user code. If you want to actually roll your own Akka, beware that you are completely on your own in that case!

  44. trait Extension extends AnyRef

    Permalink

    The basic ActorSystem covers all that is needed for locally running actors, using futures and so on.

    The basic ActorSystem covers all that is needed for locally running actors, using futures and so on. In addition, more features can hook into it and thus become visible to actors et al by registering themselves as extensions. This is accomplished by providing an extension—which is an object implementing this trait—to ActorSystem.registerExtension(...) or by specifying the corresponding option in the configuration passed to ActorSystem, which will then instantiate (without arguments) each FQCN and register the result.

    The extension itself can be created in any way desired and has full access to the ActorSystem implementation.

    This trait is only a marker interface to signify an Akka Extension. This is how an extension is normally constructed.

    Scala API:

    object MyExt extends ExtensionId[Ext] with ExtensionIdProvider {
    
      override def lookup = MyExt
    
      override def createExtension(system: ExtendedActorSystem): Ext = new Ext(system)
    
      // Java API: retrieve the extension for the given system.
      override def get(system: ActorSystem): UdpExt = super.get(system)
    }
    
    class Ext(system: ExtendedActorSystem) extends Extension {
      ...
    }

    Java API:

    public class MyExt extends AbstractExtensionId<MyExtImpl>
      implements ExtensionIdProvider {
      public final static MyExt MyExtProvider = new MyExt();
    
      private MyExt() {}
    
      public MyExt lookup() {
        return MyExt.MyExtProvider;
      }
    
      public MyExtImpl createExtension(ExtendedActorSystem system) {
        return new MyExtImpl();
      }
    }
    
    public class MyExtImpl implements Extension {
       ...
    }

    See also akka.actor.ExtensionKey for a concise way of formulating extensions.

  45. trait ExtensionId[T <: Extension] extends AnyRef

    Permalink

    Identifies an Extension Lookup of Extensions is done by object identity, so the Id must be the same wherever it's used, otherwise you'll get the same extension loaded multiple times.

  46. trait ExtensionIdProvider extends AnyRef

    Permalink

    To be able to load an ExtensionId from the configuration, a class that implements ExtensionIdProvider must be specified.

    To be able to load an ExtensionId from the configuration, a class that implements ExtensionIdProvider must be specified. The lookup method should return the canonical reference to the extension.

  47. abstract class ExtensionKey[T <: Extension] extends ExtensionId[T] with ExtensionIdProvider

    Permalink

    This is a one-stop-shop if all you want is an extension which is constructed with the ExtendedActorSystem as its only constructor argument:

    This is a one-stop-shop if all you want is an extension which is constructed with the ExtendedActorSystem as its only constructor argument:

    object MyExt extends ExtensionKey[Ext]
    
    class Ext(system: ExtendedActorSystem) extends Extension {
      ...
    }

    Java API:

    public class MyExt extends Extension {
      public static final ExtensionKey<MyExt> key = new ExtensionKey<MyExt>(MyExt.class);
    
      public MyExt(ExtendedActorSystem system) {
        ...
      }
    }

    Note: Don't use this class if the extension is written in Scala and consumed in Eclipse Java projects. JDT has problems resolving correct type for the get method.

  48. trait FSM[S, D] extends Actor with Listeners with ActorLogging

    Permalink

    Finite State Machine actor trait.

    Finite State Machine actor trait. Use as follows:

      object A {
        trait State
        case class One extends State
        case class Two extends State
    
        case class Data(i : Int)
      }
    
      class A extends Actor with FSM[A.State, A.Data] {
        import A._
    
        startWith(One, Data(42))
        when(One) {
            case Event(SomeMsg, Data(x)) => ...
            case Ev(SomeMsg) => ... // convenience when data not needed
        }
        when(Two, stateTimeout = 5 seconds) { ... }
        initialize()
      }
    

    Within the partial function the following values are returned for effecting state transitions:

    • stay for staying in the same state
    • stay using Data(...) for staying in the same state, but with different data
    • stay forMax 5.millis for staying with a state timeout; can be combined with using
    • goto(...) for changing into a different state; also supports using and forMax
    • stop for terminating this FSM actor

    Each of the above also supports the method replying(AnyRef) for sending a reply before changing state.

    While changing state, custom handlers may be invoked which are registered using onTransition. This is meant to enable concentrating different concerns in different places; you may choose to use when for describing the properties of a state, including of course initiating transitions, but you can describe the transitions using onTransition to avoid having to duplicate that code among multiple paths which lead to a transition:

    onTransition {
      case Active -> _ => cancelTimer("activeTimer")
    }
    

    Multiple such blocks are supported and all of them will be called, not only the first matching one.

    Another feature is that other actors may subscribe for transition events by sending a SubscribeTransitionCallback message to this actor. Stopping a listener without unregistering will not remove the listener from the subscription list; use UnsubscribeTransitionCallback before stopping the listener.

    State timeouts set an upper bound to the time which may pass before another message is received in the current state. If no external message is available, then upon expiry of the timeout a StateTimeout message is sent. Note that this message will only be received in the state for which the timeout was set and that any message received will cancel the timeout (possibly to be started again by the next transition).

    Another feature is the ability to install and cancel single-shot as well as repeated timers which arrange for the sending of a user-specified message:

      setTimer("tock", TockMsg, 1 second, true) // repeating
      setTimer("lifetime", TerminateMsg, 1 hour, false) // single-shot
      cancelTimer("tock")
      isTimerActive("tock")
    

  49. final case class Identify(messageId: Any) extends AutoReceivedMessage with NotInfluenceReceiveTimeout with Product with Serializable

    Permalink

    A message all Actors will understand, that when processed will reply with akka.actor.ActorIdentity containing the ActorRef.

    A message all Actors will understand, that when processed will reply with akka.actor.ActorIdentity containing the ActorRef. The messageId is returned in the ActorIdentity message as correlationId.

    Annotations
    @SerialVersionUID()
  50. final case class IllegalActorStateException extends AkkaException with Product with Serializable

    Permalink

    IllegalActorStateException is thrown when a core invariant in the Actor implementation has been violated.

    IllegalActorStateException is thrown when a core invariant in the Actor implementation has been violated. For instance, if you try to create an Actor that doesn't extend Actor.

    Annotations
    @SerialVersionUID()
  51. abstract class Inbox extends AnyRef

    Permalink

    An Inbox is an actor-like object which is interrogated from the outside.

    An Inbox is an actor-like object which is interrogated from the outside. It contains an actor whose reference can be passed to other actors as usual and it can watch other actors’ lifecycle.

  52. trait IndirectActorProducer extends AnyRef

    Permalink

    This interface defines a class of actor creation strategies deviating from the usual default of just reflectively instantiating the Actor subclass.

    This interface defines a class of actor creation strategies deviating from the usual default of just reflectively instantiating the Actor subclass. It can be used to allow a dependency injection framework to determine the actual actor class and how it shall be instantiated.

  53. final case class InvalidActorNameException(message: String) extends AkkaException with Product with Serializable

    Permalink

    An InvalidActorNameException is thrown when you try to convert something, usually a String, to an Actor name which doesn't validate.

    An InvalidActorNameException is thrown when you try to convert something, usually a String, to an Actor name which doesn't validate.

    Annotations
    @SerialVersionUID()
  54. final case class InvalidMessageException extends AkkaException with Product with Serializable

    Permalink

    InvalidMessageException is thrown when an invalid message is sent to an Actor; Currently only null is an invalid message.

    InvalidMessageException is thrown when an invalid message is sent to an Actor; Currently only null is an invalid message.

    Annotations
    @SerialVersionUID()
  55. abstract class Kill extends AutoReceivedMessage with PossiblyHarmful

    Permalink
  56. class LightArrayRevolverScheduler extends Scheduler with Closeable

    Permalink

    This scheduler implementation is based on a revolving wheel of buckets, like Netty’s HashedWheelTimer, which it advances at a fixed tick rate and dispatches tasks it finds in the current bucket to their respective ExecutionContexts.

    This scheduler implementation is based on a revolving wheel of buckets, like Netty’s HashedWheelTimer, which it advances at a fixed tick rate and dispatches tasks it finds in the current bucket to their respective ExecutionContexts. The tasks are held in TaskHolders, which upon cancellation null out their reference to the actual task, leaving only this shell to be cleaned up when the wheel reaches that bucket next time. This enables the use of a simple linked list to chain the TaskHolders off the wheel.

    Also noteworthy is that this scheduler does not obtain a current time stamp when scheduling single-shot tasks, instead it always rounds up the task delay to a full multiple of the TickDuration. This means that tasks are scheduled possibly one tick later than they could be (if checking that “now() + delay <= nextTick” were done).

  57. abstract class LocalScope extends Scope

    Permalink
    Annotations
    @SerialVersionUID()
  58. trait LoggingFSM[S, D] extends FSM[S, D]

    Permalink

    Stackable trait for akka.actor.FSM which adds a rolling event log and debug logging capabilities (analogous to akka.event.LoggingReceive).

    Stackable trait for akka.actor.FSM which adds a rolling event log and debug logging capabilities (analogous to akka.event.LoggingReceive).

    Since

    1.2

  59. abstract class NoScopeGiven extends Scope

    Permalink

    This is the default value and as such allows overrides.

    This is the default value and as such allows overrides.

    Annotations
    @SerialVersionUID()
  60. trait NoSerializationVerificationNeeded extends AnyRef

    Permalink

    Marker trait to signal that this class should not be verified for serializability.

  61. trait NotInfluenceReceiveTimeout extends AnyRef

    Permalink

    Marker trait to indicate that a message should not reset the receive timeout.

  62. case class OneForOneStrategy(maxNrOfRetries: Int = 1, withinTimeRange: Duration = Duration.Inf, loggingEnabled: Boolean = true)(decider: Decider) extends SupervisorStrategy with Product with Serializable

    Permalink

    Applies the fault handling Directive (Resume, Restart, Stop) specified in the Decider to the child actor that failed, as opposed to akka.actor.AllForOneStrategy that applies it to all children.

    Applies the fault handling Directive (Resume, Restart, Stop) specified in the Decider to the child actor that failed, as opposed to akka.actor.AllForOneStrategy that applies it to all children.

    maxNrOfRetries

    the number of times a child actor is allowed to be restarted, negative value means no limit, if the limit is exceeded the child actor is stopped

    withinTimeRange

    duration of the time window for maxNrOfRetries, Duration.Inf means no window

    loggingEnabled

    the strategy logs the failure if this is enabled (true), by default it is enabled

    decider

    mapping from Throwable to akka.actor.SupervisorStrategy.Directive, you can also use a scala.collection.immutable.Seq of Throwables which maps the given Throwables to restarts, otherwise escalates.

  63. abstract class PoisonPill extends AutoReceivedMessage with PossiblyHarmful with DeadLetterSuppression

    Permalink
  64. trait PossiblyHarmful extends AnyRef

    Permalink

    Marker trait to indicate that a message might be potentially harmful, this is used to block messages coming in over remoting.

  65. final case class PostRestartException extends ActorInitializationException with Product with Serializable

    Permalink

    A PostRestartException is thrown when constructor or postRestart() method fails during a restart attempt.

    A PostRestartException is thrown when constructor or postRestart() method fails during a restart attempt.

    Annotations
    @SerialVersionUID()
  66. final case class PreRestartException extends ActorInitializationException with Product with Serializable

    Permalink

    A PreRestartException is thrown when the preRestart() method failed; this exception is not propagated to the supervisor, as it originates from the already failed instance, hence it is only visible as log entry on the event stream.

    A PreRestartException is thrown when the preRestart() method failed; this exception is not propagated to the supervisor, as it originates from the already failed instance, hence it is only visible as log entry on the event stream.

    Annotations
    @SerialVersionUID()
  67. final case class Props(deploy: Deploy, clazz: Class[_], args: Seq[Any]) extends Product with Serializable

    Permalink

    Props is a configuration object using in creating an Actor; it is immutable, so it is thread-safe and fully shareable.

    Props is a configuration object using in creating an Actor; it is immutable, so it is thread-safe and fully shareable.

    Examples on Scala API:

    val props = Props.empty
    val props = Props[MyActor]
    val props = Props(classOf[MyActor], arg1, arg2)
    
    val otherProps = props.withDispatcher("dispatcher-id")
    val otherProps = props.withDeploy(<deployment info>)

    Examples on Java API:

    final Props props = Props.empty();
    final Props props = Props.create(MyActor.class, arg1, arg2);
    
    final Props otherProps = props.withDispatcher("dispatcher-id");
    final Props otherProps = props.withDeploy(<deployment info>);
    Annotations
    @SerialVersionUID()
  68. abstract class ProviderSelection extends AnyRef

    Permalink
  69. abstract class ReceiveTimeout extends PossiblyHarmful

    Permalink
  70. class ReflectiveDynamicAccess extends DynamicAccess

    Permalink

    This is the default akka.actor.DynamicAccess implementation used by akka.actor.ExtendedActorSystem unless overridden.

    This is the default akka.actor.DynamicAccess implementation used by akka.actor.ExtendedActorSystem unless overridden. It uses reflection to turn fully-qualified class names into Class[_] objects and creates instances from there using getDeclaredConstructor() and invoking that. The class loader to be used for all this is determined by the actor system’s class loader by default.

  71. final case class RootActorPath(address: Address, name: String = "/") extends ActorPath with Product with Serializable

    Permalink

    Root of the hierarchy of ActorPaths.

    Root of the hierarchy of ActorPaths. There is exactly root per ActorSystem and node (for remote-enabled or clustered systems).

    Annotations
    @SerialVersionUID()
  72. trait ScalaActorRef extends AnyRef

    Permalink

    This trait represents the Scala Actor API There are implicit conversions in ../actor/Implicits.scala from ActorRef -> ScalaActorRef and back

  73. trait ScalaActorSelection extends AnyRef

    Permalink

    Contains the Scala API (!-method) for ActorSelections) which provides automatic tracking of the sender, as per the usual implicit ActorRef pattern.

  74. trait Scheduler extends AnyRef

    Permalink

    An Akka scheduler service.

    An Akka scheduler service. This one needs one special behavior: if Closeable, it MUST execute all outstanding tasks upon .close() in order to properly shutdown all dispatchers.

    Furthermore, this timer service MUST throw IllegalStateException if it cannot schedule a task. Once scheduled, the task MUST be executed. If executed upon close(), the task may execute before its timeout.

    Scheduler implementation are loaded reflectively at ActorSystem start-up with the following constructor arguments: 1) the system’s com.typesafe.config.Config (from system.settings.config) 2) a akka.event.LoggingAdapter 3) a java.util.concurrent.ThreadFactory

  75. trait Scope extends AnyRef

    Permalink

    The scope of a akka.actor.Deploy serves two purposes: as a marker for pattern matching the “scope” (i.e.

    The scope of a akka.actor.Deploy serves two purposes: as a marker for pattern matching the “scope” (i.e. local/remote/cluster) as well as for extending the information carried by the final Deploy class. Scopes can be used in conjunction with a custom akka.actor.ActorRefProvider, making Akka actors fully extensible.

  76. trait Stash extends UnrestrictedStash with RequiresMessageQueue[DequeBasedMessageQueueSemantics]

    Permalink

    The Stash trait enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior.

    The Stash trait enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior.

    Example:

       class ActorWithProtocol extends Actor with Stash {
         def receive = {
           case "open" ⇒
             unstashAll()
             context.become({
               case "write" ⇒ // do writing...
               case "close" ⇒
                 unstashAll()
                 context.unbecome()
               case msg ⇒ stash()
             }, discardOld = false)
           case "done" ⇒ // done
           case msg    ⇒ stash()
         }
       }
    

    Note that the Stash trait can only be used together with actors that have a deque-based mailbox. By default Stash based actors request a Deque based mailbox since the stash trait extends RequiresMessageQueue[DequeBasedMessageQueueSemantics]. You can override the default mailbox provided when DequeBasedMessageQueueSemantics are requested via config:

       akka.actor.mailbox.requirements {
         "akka.dispatch.BoundedDequeBasedMessageQueueSemantics" = your-custom-mailbox
       }
    
    Alternatively, you can add your own requirement marker to the actor and configure a mailbox type to be used for your marker.

    For a Stash that also enforces unboundedness of the deque see akka.actor.UnboundedStash. For a Stash that does not enforce any mailbox type see akka.actor.UnrestrictedStash.

    Note that the Stash trait must be mixed into (a subclass of) the Actor trait before any trait/class that overrides the preRestart callback. This means it's not possible to write Actor with MyActor with Stash if MyActor overrides preRestart.

  77. class StashOverflowException extends AkkaException with NoStackTrace

    Permalink

    Is thrown when the size of the Stash exceeds the capacity of the Stash

  78. final class StoppingSupervisorStrategy extends SupervisorStrategyConfigurator

    Permalink
  79. abstract class SupervisorStrategy extends AnyRef

    Permalink

    An Akka SupervisorStrategy is the policy to apply for crashing children.

    An Akka SupervisorStrategy is the policy to apply for crashing children.

    IMPORTANT:

    You should not normally need to create new subclasses, instead use the existing akka.actor.OneForOneStrategy or akka.actor.AllForOneStrategy, but if you do, please read the docs of the methods below carefully, as incorrect implementations may lead to “blocked” actor systems (i.e. permanently suspended actors).

  80. trait SupervisorStrategyConfigurator extends AnyRef

    Permalink

    Implement this interface in order to configure the supervisorStrategy for the top-level guardian actor (/user).

    Implement this interface in order to configure the supervisorStrategy for the top-level guardian actor (/user). An instance of this class must be instantiable using a no-arg constructor.

  81. trait SupervisorStrategyLowPriorityImplicits extends AnyRef

    Permalink
  82. final case class SuppressedDeadLetter(message: DeadLetterSuppression, sender: ActorRef, recipient: ActorRef) extends AllDeadLetters with Product with Serializable

    Permalink

    Similar to DeadLetter with the slight twist of NOT being logged by the default dead letters listener.

    Similar to DeadLetter with the slight twist of NOT being logged by the default dead letters listener. Messages which end up being suppressed dead letters are internal messages for which ending up as dead-letter is both expected and harmless.

    It is possible to subscribe to suppressed dead letters on the ActorSystem's EventStream explicitly.

    Annotations
    @SerialVersionUID()
  83. final case class Terminated extends AutoReceivedMessage with PossiblyHarmful with DeadLetterSuppression with Product with Serializable

    Permalink

    When Death Watch is used, the watcher will receive a Terminated(watched) message when watched is terminated.

    When Death Watch is used, the watcher will receive a Terminated(watched) message when watched is terminated. Terminated message can't be forwarded to another actor, since that actor might not be watching the subject. Instead, if you need to forward Terminated to another actor you should send the information in your own message.

    Annotations
    @SerialVersionUID()
  84. class TypedActorExtension extends TypedActorFactory with Extension

    Permalink
  85. trait TypedActorFactory extends AnyRef

    Permalink

    A TypedActorFactory is something that can created TypedActor instances.

  86. final case class TypedProps[T <: AnyRef](interfaces: Seq[Class[_]], creator: () ⇒ T, dispatcher: String = TypedProps.defaultDispatcherId, deploy: Deploy = Props.defaultDeploy, timeout: Option[Timeout] = TypedProps.defaultTimeout, loader: Option[ClassLoader] = TypedProps.defaultLoader) extends Product with Serializable

    Permalink

    TypedProps is a TypedActor configuration object, that is thread safe and fully sharable.

    TypedProps is a TypedActor configuration object, that is thread safe and fully sharable. It's used in TypedActorFactory.typedActorOf to configure a TypedActor instance.

    Annotations
    @SerialVersionUID()
  87. trait UnboundedStash extends UnrestrictedStash with RequiresMessageQueue[UnboundedDequeBasedMessageQueueSemantics]

    Permalink

    The UnboundedStash trait is a version of akka.actor.Stash that enforces an unbounded stash for you actor.

  88. final case class UnhandledMessage(message: Any, sender: ActorRef, recipient: ActorRef) extends Product with Serializable

    Permalink

    This message is published to the EventStream whenever an Actor receives a message it doesn't understand

    This message is published to the EventStream whenever an Actor receives a message it doesn't understand

    Annotations
    @SerialVersionUID()
  89. trait UnrestrictedStash extends Actor with StashSupport

    Permalink

    A version of akka.actor.Stash that does not enforce any mailbox type.

    A version of akka.actor.Stash that does not enforce any mailbox type. The proper mailbox has to be configured manually, and the mailbox should extend the akka.dispatch.DequeBasedMessageQueueSemantics marker trait.

  90. abstract class UntypedActor extends Actor

    Permalink

    Actor base trait that should be extended by or mixed to create an Actor with the semantics of the 'Actor Model': http://en.wikipedia.org/wiki/Actor_model

    Actor base trait that should be extended by or mixed to create an Actor with the semantics of the 'Actor Model': http://en.wikipedia.org/wiki/Actor_model

    This class is the Java cousin to the akka.actor.Actor Scala interface. Subclass this abstract class to create a MDB-style untyped actor.

    An actor has a well-defined (non-cyclic) life-cycle.

    • RUNNING (created and started actor) - can receive messages
    • SHUTDOWN (when 'stop' or 'exit' is invoked) - can't do anything

    The Actor's own akka.actor.ActorRef is available as getSelf(), the current message’s sender as getSender() and the akka.actor.UntypedActorContext as getContext(). The only abstract method is onReceive() which is invoked for each processed message unless dynamically overridden using getContext().become().

    Here is an example on how to create and use an UntypedActor:

    public class SampleUntypedActor extends UntypedActor {
    
      public static class Reply implements java.io.Serializable {
        final public ActorRef sender;
        final public Result result;
        Reply(ActorRef sender, Result result) {
          this.sender = sender;
          this.result = result;
        }
      }
    
     private static SupervisorStrategy strategy = new OneForOneStrategy(10, Duration.create("1 minute"),
       new Function<Throwable, Directive>() {
         @Override
         public Directive apply(Throwable t) {
           if (t instanceof ArithmeticException) {
             return resume();
           } else if (t instanceof NullPointerException) {
             return restart();
           } else if (t instanceof IllegalArgumentException) {
             return stop();
           } else {
             return escalate();
           }
         }
       });
    
     @Override
     public SupervisorStrategy supervisorStrategy() {
       return strategy;
      }
    
      public void onReceive(Object message) throws Exception {
        if (message instanceof String) {
          String msg = (String) message;
    
          if (msg.equals("UseSender")) {
            // Reply to original sender of message
            getSender().tell(msg, getSelf());
    
          } else if (msg.equals("SendToSelf")) {
            // Send message to the actor itself recursively
            getSelf().tell("SomeOtherMessage", getSelf());
    
          } else if (msg.equals("ErrorKernelWithDirectReply")) {
            // Send work to one-off child which will reply directly to original sender
            getContext().actorOf(Props.create(Worker.class)).tell("DoSomeDangerousWork", getSender());
    
          } else if (msg.equals("ErrorKernelWithReplyHere")) {
            // Send work to one-off child and collect the answer, reply handled further down
            getContext().actorOf(Props.create(Worker.class)).tell("DoWorkAndReplyToMe", getSelf());
    
          } else {
            unhandled(message);
          }
    
        } else if (message instanceof Reply) {
    
          final Reply reply = (Reply) message;
          // might want to do some processing/book-keeping here
          reply.sender.tell(reply.result, getSelf());
    
        } else {
          unhandled(message);
        }
      }
    }
  91. trait UntypedActorContext extends ActorContext

    Permalink

    UntypedActorContext is the UntypedActor equivalent of ActorContext, containing the Java API

  92. abstract class UntypedActorWithStash extends UntypedActor with Stash

    Permalink

    Actor base class that should be extended to create an actor with a stash.

    Actor base class that should be extended to create an actor with a stash.

    The stash enables an actor to temporarily stash away messages that can not or should not be handled using the actor's current behavior.

    Example:

      public class MyActorWithStash extends UntypedActorWithStash {
        int count = 0;
        public void onReceive(Object msg) {
          if (msg instanceof String) {
            if (count < 0) {
              getSender().tell(new Integer(((String) msg).length()), getSelf());
            } else if (count == 2) {
              count = -1;
              unstashAll();
            } else {
              count += 1;
              stash();
            }
          }
        }
      }
    
    Note that the subclasses of UntypedActorWithStash by default request a Deque based mailbox since this class implements the RequiresMessageQueue<DequeBasedMessageQueueSemantics> marker interface. You can override the default mailbox provided when DequeBasedMessageQueueSemantics are requested via config:
      akka.actor.mailbox.requirements {
        "akka.dispatch.BoundedDequeBasedMessageQueueSemantics" = your-custom-mailbox
      }
    
    Alternatively, you can add your own requirement marker to the actor and configure a mailbox type to be used for your marker.

    For a Stash based actor that enforces unbounded deques see akka.actor.UntypedActorWithUnboundedStash. There is also an unrestricted version akka.actor.UntypedActorWithUnrestrictedStash that does not enforce the mailbox type.

  93. abstract class UntypedActorWithUnboundedStash extends UntypedActor with UnboundedStash

    Permalink

    Actor base class with Stash that enforces an unbounded deque for the actor.

    Actor base class with Stash that enforces an unbounded deque for the actor. See akka.actor.UntypedActorWithStash for details on how Stash works.

  94. abstract class UntypedActorWithUnrestrictedStash extends UntypedActor with UnrestrictedStash

    Permalink

    Actor base class with Stash that does not enforce any mailbox type.

    Actor base class with Stash that does not enforce any mailbox type. The proper mailbox has to be configured manually, and the mailbox should extend the akka.dispatch.DequeBasedMessageQueueSemantics marker trait. See akka.actor.UntypedActorWithStash for details on how Stash works.

Value Members

  1. object AbstractActor

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

  2. object AbstractFSM

    Permalink

    Java API: compatible with lambda expressions

    Java API: compatible with lambda expressions

    This is an EXPERIMENTAL feature and is subject to change until it has received more real world testing.

    Annotations
    @ApiMayChange()
  3. object Actor

    Permalink
  4. object ActorInitializationException extends Serializable

    Permalink
  5. object ActorPath extends Serializable

    Permalink
  6. object ActorPathExtractor extends PathUtils

    Permalink

    Given an ActorPath it returns the Address and the path elements if the path is well-formed

  7. object ActorPaths

    Permalink

    Java API

  8. object ActorRef extends Serializable

    Permalink
  9. object ActorSelection extends Serializable

    Permalink

    An ActorSelection is a logical view of a section of an ActorSystem's tree of Actors, allowing for broadcasting of messages to that section.

  10. object ActorSystem

    Permalink
  11. object Address extends Serializable

    Permalink
  12. object AddressFromURIString

    Permalink

    This object serves as extractor for Scala and as address parser for Java.

  13. object BootstrapSetup

    Permalink
  14. object CoordinatedShutdown extends ExtensionId[CoordinatedShutdown] with ExtensionIdProvider

    Permalink
  15. object Deploy extends Serializable

    Permalink
  16. object FSM

    Permalink
  17. object Inbox

    Permalink
  18. object Kill extends Kill with Product with Serializable

    Permalink

    A message all Actors will understand, that when processed will make the Actor throw an ActorKilledException, which will trigger supervision.

    A message all Actors will understand, that when processed will make the Actor throw an ActorKilledException, which will trigger supervision.

    Annotations
    @SerialVersionUID()
  19. object LightArrayRevolverScheduler

    Permalink
  20. object LocalScope extends LocalScope with Product with Serializable

    Permalink

    The Local Scope is the default one, which is assumed on all deployments which do not set a different scope.

    The Local Scope is the default one, which is assumed on all deployments which do not set a different scope. It is also the only scope handled by the LocalActorRefProvider.

    Annotations
    @SerialVersionUID()
  21. object NoScopeGiven extends NoScopeGiven with Product with Serializable

    Permalink
    Annotations
    @SerialVersionUID()
  22. object OriginalRestartException

    Permalink

    This is an extractor for retrieving the original cause (i.e.

    This is an extractor for retrieving the original cause (i.e. the first failure) from a akka.actor.PostRestartException. In the face of multiple “nested” restarts it will walk the origCause-links until it arrives at a non-PostRestartException type.

    Annotations
    @SerialVersionUID()
  23. object PoisonPill extends PoisonPill with Product with Serializable

    Permalink

    A message all Actors will understand, that when processed will terminate the Actor permanently.

    A message all Actors will understand, that when processed will terminate the Actor permanently.

    Annotations
    @SerialVersionUID()
  24. object Props extends AbstractProps with Serializable

    Permalink

    Factory for Props instances.

    Factory for Props instances.

    Props is a ActorRef configuration object, that is immutable, so it is thread safe and fully sharable.

    Used when creating new actors through ActorSystem.actorOf and ActorContext.actorOf.

  25. object ProviderSelection

    Permalink
  26. object ReceiveTimeout extends ReceiveTimeout with Product with Serializable

    Permalink

    When using ActorContext.setReceiveTimeout, the singleton instance of ReceiveTimeout will be sent to the Actor when there hasn't been any message for that long.

    When using ActorContext.setReceiveTimeout, the singleton instance of ReceiveTimeout will be sent to the Actor when there hasn't been any message for that long.

    Annotations
    @SerialVersionUID()
  27. object RelativeActorPath extends PathUtils

    Permalink

    Extractor for so-called “relative actor paths” as in “relative URI”, not in “relative to some actor”.

    Extractor for so-called “relative actor paths” as in “relative URI”, not in “relative to some actor”. Examples:

    * "grand/child" * "/user/hello/world"

  28. object Status

    Permalink

    Classes for passing status back to the sender.

    Classes for passing status back to the sender. Used for internal ACKing protocol. But exposed as utility class for user-specific ACKing protocols as well.

  29. object SupervisorStrategy extends SupervisorStrategyLowPriorityImplicits

    Permalink
  30. object TypedActor extends ExtensionId[TypedActorExtension] with ExtensionIdProvider

    Permalink

    This represents the TypedActor Akka Extension, access to the functionality is done through a given ActorSystem.

  31. object TypedProps extends Serializable

    Permalink

    TypedProps is a TypedActor configuration object, that is thread safe and fully sharable.

    TypedProps is a TypedActor configuration object, that is thread safe and fully sharable. It's used in TypedActorFactory.typedActorOf to configure a TypedActor instance.

  32. implicit def actorRef2Scala(ref: ActorRef): ScalaActorRef

    Permalink
  33. package dsl

    Permalink
  34. implicit def scala2ActorRef(ref: ScalaActorRef): ActorRef

    Permalink
  35. package setup

    Permalink

Deprecated Value Members

  1. object ActorDSL extends actor.dsl.Inbox with Creators

    Permalink

    This object contains elements which make writing actors and related code more concise, e.g.

    This object contains elements which make writing actors and related code more concise, e.g. when trying out actors in the REPL.

    For the communication of non-actor code with actors, you may use anonymous actors tailored to this job:

    import ActorDSL._
    import scala.concurrent.util.duration._
    
    implicit val system: ActorSystem = ...
    
    implicit val i = inbox()
    someActor ! someMsg // replies will go to `i`
    
    val reply = i.receive()
    val transformedReply = i.select(5 seconds) {
      case x: Int => 2 * x
    }

    The receive and select methods are synchronous, i.e. they block the calling thread until an answer from the actor is received or the timeout expires. The default timeout is taken from configuration item akka.actor.dsl.default-timeout.

    When defining actors in the REPL, say, you may want to have a look at the Act trait:

    import ActorDSL._
    
    val system: ActorSystem = ...
    
    val a = actor(system, "fred")(new Act {
        val b = actor("barney")(new Act {
            ...
          })
    
        become {
          case msg => ...
        }
      })

    Note that actor can be used with an implicit akka.actor.ActorRefFactory as shown with "barney" (where the akka.actor.ActorContext serves this purpose), but since nested declarations share the same lexical context "fred"’s ActorContext would be ambiguous if the akka.actor.ActorSystem were declared implicit (this could also be circumvented by shadowing the name system within "fred").

    Note: If you want to use an Act with Stash, you should use the ActWithStash trait in order to have the actor get the necessary deque-based mailbox setting.

    Annotations
    @deprecated
    Deprecated

    (Since version 2.5.0) deprecated Use the normal actorOf methods defined on ActorSystem and ActorContext to create Actors instead.

Inherited from AnyRef

Inherited from Any

Ungrouped