t

akka.typed

ActorContext

trait ActorContext[T] extends AnyRef

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 ! or tell 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 DeathWatch and timed message scheduling.

Source
ActorContext.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ActorContext
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def cancelReceiveTimeout(): Unit

    Cancel the sending of receive timeout notifications.

  2. abstract def child(name: String): Option[ActorRef[Nothing]]

    The named child Actor if it is alive.

  3. abstract def children: Iterable[ActorRef[Nothing]]

    The list of child Actors created by this Actor during its lifetime that are still alive, in no particular order.

  4. implicit abstract def executionContext: ExecutionContextExecutor

    This Actor’s execution context.

    This Actor’s execution context. It can be used to run asynchronous tasks like scala.concurrent.Future combinators.

  5. abstract def mailboxCapacity: Int

    Return the mailbox capacity that was configured by the parent for this actor.

  6. abstract def schedule[U](delay: FiniteDuration, target: ActorRef[U], msg: U): Cancellable

    Schedule the sending of the given message to the given target Actor after the given time period has elapsed.

    Schedule the sending of the given message to the given target Actor after the given time period has elapsed. The scheduled action can be cancelled by invoking akka.actor.Cancellable cancel on the returned handle.

  7. abstract def self: ActorRef[T]

    The identity of this Actor, bound to the lifecycle of this Actor instance.

    The identity of this Actor, bound to the lifecycle of this Actor instance. An Actor with the same name that lives before or after this instance will have a different ActorRef.

  8. abstract def setReceiveTimeout(d: FiniteDuration, msg: T): Unit

    Schedule the sending of a notification in case no other message is received during the given period of time.

    Schedule the sending of a notification in case no other message is received during the given period of time. The timeout starts anew with each received message. Provide Duration.Undefined to switch off this mechanism.

  9. abstract def spawn[U](behavior: Behavior[U], name: String, deployment: DeploymentConfig = EmptyDeploymentConfig): ActorRef[U]

    Create a child Actor from the given Props and with the given name.

  10. abstract def spawnAdapter[U](f: (U) ⇒ T): ActorRef[U]

    Create a child actor that will wrap messages such that other Actor’s protocols can be ingested by this Actor.

    Create a child actor that will wrap messages such that other Actor’s protocols can be ingested by this Actor. You are strongly advised to cache these ActorRefs or to stop them when no longer needed.

  11. abstract def spawnAnonymous[U](behavior: Behavior[U], deployment: DeploymentConfig = EmptyDeploymentConfig): ActorRef[U]

    Create a child Actor from the given Props under a randomly chosen name.

    Create a child Actor from the given Props under a randomly chosen name. It is good practice to name Actors wherever practical.

  12. abstract def stop(child: ActorRef[Nothing]): Boolean

    Force the child Actor under the given name to terminate after it finishes processing its current message.

    Force the child Actor under the given name to terminate after it finishes processing its current message. Nothing happens if the ActorRef does not refer to a current child actor.

    returns

    whether the passed-in ActorRef points to a current child Actor

  13. abstract def system: ActorSystem[Nothing]

    The ActorSystem to which this Actor belongs.

  14. abstract def unwatch[U](other: ActorRef[U]): ActorRef[U]

    Revoke the registration established by watch.

    Revoke the registration established by watch. A Terminated notification will not subsequently be received for the referenced Actor.

  15. abstract def watch[U](other: ActorRef[U]): ActorRef[U]

    Register for Terminated notification once the Actor identified by the given ActorRef terminates.

    Register for Terminated notification once the Actor identified by the given ActorRef terminates. This notification is also generated when the ActorSystem to which the referenced Actor belongs is declared as failed (e.g. in reaction to being unreachable).

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to any2stringadd[ActorContext[T]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (ActorContext[T], B)
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to ArrowAssoc[ActorContext[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. def ensuring(cond: (ActorContext[T]) ⇒ Boolean, msg: ⇒ Any): ActorContext[T]
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to Ensuring[ActorContext[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  9. def ensuring(cond: (ActorContext[T]) ⇒ Boolean): ActorContext[T]
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to Ensuring[ActorContext[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: Boolean, msg: ⇒ Any): ActorContext[T]
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to Ensuring[ActorContext[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean): ActorContext[T]
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to Ensuring[ActorContext[T]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  14. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to StringFormat[ActorContext[T]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  23. def toString(): String
    Definition Classes
    AnyRef → Any
  24. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. def [B](y: B): (ActorContext[T], B)
    Implicit
    This member is added by an implicit conversion from ActorContext[T] to ArrowAssoc[ActorContext[T]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from ActorContext[T] to any2stringadd[ActorContext[T]]

Inherited by implicit conversion StringFormat from ActorContext[T] to StringFormat[ActorContext[T]]

Inherited by implicit conversion Ensuring from ActorContext[T] to Ensuring[ActorContext[T]]

Inherited by implicit conversion ArrowAssoc from ActorContext[T] to ArrowAssoc[ActorContext[T]]

Ungrouped