o

akka.typed

ScalaDSL

object ScalaDSL

This object holds several behavior factories and combinators that can be used to construct Behavior instances.

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

Type Members

  1. final case class And [T](left: Behavior[T], right: Behavior[T]) extends Behavior[T] with Product with Serializable

    A behavior combinator that feeds incoming messages and signals both into the left and right sub-behavior and allows them to evolve independently of each other.

    A behavior combinator that feeds incoming messages and signals both into the left and right sub-behavior and allows them to evolve independently of each other. When one of the sub-behaviors terminates the other takes over exclusively. When both sub-behaviors respond to a Failed signal, the response with the higher precedence is chosen (see Failed$).

  2. implicit final class BehaviorDecorators [T] extends AnyVal
  3. final case class Deferred [T](factory: () ⇒ Behavior[T]) extends Behavior[T] with Product with Serializable

    Wrap a behavior factory so that it runs upon PreStart, i.e.

    Wrap a behavior factory so that it runs upon PreStart, i.e. behavior creation is deferred to the child actor instead of running within the parent.

  4. final case class Full [T](behavior: PartialFunction[MessageOrSignal[T], Behavior[T]]) extends Behavior[T] with Product with Serializable

    This type of behavior allows to handle all incoming messages within the same user-provided partial function, be that a user message or a system signal.

    This type of behavior allows to handle all incoming messages within the same user-provided partial function, be that a user message or a system signal. For messages that do not match the partial function the same behavior is emitted without change. This does entail that unhandled failures of child actors will lead to a failure in this actor.

    For the lifecycle notifications pertaining to the actor itself this behavior includes a fallback mechanism: an unhandled PreRestart signal will terminate all child actors (transitively) and then emit a PostStop signal in addition, whereas an unhandled PostRestart signal will emit an additional PreStart signal.

  5. final case class FullTotal [T](behavior: (MessageOrSignal[T]) ⇒ Behavior[T]) extends Behavior[T] with Product with Serializable

    This type of behavior expects a total function that describes the actor’s reaction to all system signals or user messages, without providing a fallback mechanism for either.

    This type of behavior expects a total function that describes the actor’s reaction to all system signals or user messages, without providing a fallback mechanism for either. If you use partial function literal syntax to create the supplied function then any message not matching the list of cases will fail this actor with a scala.MatchError.

  6. sealed trait MessageOrSignal [T] extends AnyRef

    Algebraic Data Type modeling either a message or a signal, including the ActorContext.

    Algebraic Data Type modeling either a message or a signal, including the ActorContext. This type is used by several of the behaviors defined in this DSL, see for example Full.

  7. final case class Msg [T](ctx: ActorContext[T], msg: T) extends MessageOrSignal[T] with Product with Serializable

    A message bundled together with the current ActorContext.

    A message bundled together with the current ActorContext.

    Annotations
    @SerialVersionUID()
  8. final case class Or [T](left: Behavior[T], right: Behavior[T]) extends Behavior[T] with Product with Serializable

    A behavior combinator that feeds incoming messages and signals either into the left or right sub-behavior and allows them to evolve independently of each other.

    A behavior combinator that feeds incoming messages and signals either into the left or right sub-behavior and allows them to evolve independently of each other. The message or signal is passed first into the left sub-behavior and only if that results in #Unhandled is it passed to the right sub-behavior. When one of the sub-behaviors terminates the other takes over exclusively. When both sub-behaviors respond to a Failed signal, the response with the higher precedence is chosen (see Failed$).

  9. final case class Partial [T](behavior: PartialFunction[T, Behavior[T]]) extends Behavior[T] with Product with Serializable

    This type of Behavior is created from a partial function from the declared message type to the next behavior, flagging all unmatched messages as #Unhandled.

    This type of Behavior is created from a partial function from the declared message type to the next behavior, flagging all unmatched messages as #Unhandled. All system signals are ignored by this behavior, which implies that a failure of a child actor will be escalated unconditionally.

    This behavior type is most useful for leaf actors that do not create child actors themselves.

  10. final case class Sig [T](ctx: ActorContext[T], signal: Signal) extends MessageOrSignal[T] with Product with Serializable

    A signal bundled together with the current ActorContext.

    A signal bundled together with the current ActorContext.

    Annotations
    @SerialVersionUID()
  11. final case class Static [T](behavior: (T) ⇒ Unit) extends Behavior[T] with Product with Serializable

    This type of behavior is a variant of Total that does not allow the actor to change behavior.

    This type of behavior is a variant of Total that does not allow the actor to change behavior. It is an efficient choice for stateless actors, possibly entering such a behavior after finishing its initialization (which may be modeled using any of the other behavior types).

    This behavior type is most useful for leaf actors that do not create child actors themselves.

  12. final case class SynchronousSelf [T](f: (ActorRef[T]) ⇒ Behavior[T]) extends Behavior[T] with Product with Serializable

    This behavior allows sending messages to itself without going through the Actor’s mailbox.

    This behavior allows sending messages to itself without going through the Actor’s mailbox. A message sent like this will be processed before the next message is taken out of the mailbox. In case of Actor failures outstanding messages that were sent to the synchronous self reference will be lost.

    This decorator is useful for passing messages between the left and right sides of And and Or combinators.

  13. final case class Tap [T](f: PartialFunction[MessageOrSignal[T], Unit], behavior: Behavior[T]) extends Behavior[T] with Product with Serializable

    This type of Behavior wraps another Behavior while allowing you to perform some action upon each received message or signal.

    This type of Behavior wraps another Behavior while allowing you to perform some action upon each received message or signal. It is most commonly used for logging or tracing what a certain Actor does.

  14. final case class Total [T](behavior: (T) ⇒ Behavior[T]) extends Behavior[T] with Product with Serializable

    This type of behavior is created from a total function from the declared message type to the next behavior, which means that all possible incoming messages for the given type must be handled.

    This type of behavior is created from a total function from the declared message type to the next behavior, which means that all possible incoming messages for the given type must be handled. All system signals are ignored by this behavior, which implies that a failure of a child actor will be escalated unconditionally.

    This behavior type is most useful for leaf actors that do not create child actors themselves.

  15. final case class Widened [T, U >: T](behavior: Behavior[T], matcher: PartialFunction[U, T]) extends Behavior[U] with Product with Serializable

    Widen the wrapped Behavior by placing a funnel in front of it: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy.

    Widen the wrapped Behavior by placing a funnel in front of it: the supplied PartialFunction decides which message to pull in (those that it is defined at) and may transform the incoming message to place them into the wrapped Behavior’s type hierarchy. Signals are not transformed.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def ContextAware[T](behavior: (ActorContext[T]) ⇒ Behavior[T]): Behavior[T]

    A behavior decorator that extracts the ActorContext while receiving the the first signal or message and uses that to construct the real behavior (which will then also receive that signal or message).

    A behavior decorator that extracts the ActorContext while receiving the the first signal or message and uses that to construct the real behavior (which will then also receive that signal or message).

    Example:

    ContextAware[MyCommand] { ctx => Simple {
        case cmd =>
          ...
      }
    }
  5. def Empty[T]: Behavior[T]

    This behavior does not handle any inputs, it is completely inert.

  6. def Ignore[T]: Behavior[T]

    This behavior does not handle any inputs, it is completely inert.

  7. def Same[T]: Behavior[T]

    Return this behavior from message processing in order to advise the system to reuse the previous behavior.

    Return this behavior from message processing in order to advise the system to reuse the previous behavior. This is provided in order to avoid the allocation overhead of recreating the current behavior where that is not necessary.

  8. def SelfAware[T](behavior: (ActorRef[T]) ⇒ Behavior[T]): Behavior[T]

    A behavior decorator that extracts the self ActorRef while receiving the the first signal or message and uses that to construct the real behavior (which will then also receive that signal or message).

    A behavior decorator that extracts the self ActorRef while receiving the the first signal or message and uses that to construct the real behavior (which will then also receive that signal or message).

    Example:

    SelfAware[MyCommand] { self =>
      Simple {
        case cmd =>
      }
    }

    This can also be used together with implicitly sender-capturing message types:

    final case class OtherMsg(msg: String)(implicit val replyTo: ActorRef[Reply])
    
    SelfAware[MyCommand] { implicit self =>
      Simple {
        case cmd =>
          other ! OtherMsg("hello") // assuming Reply <: MyCommand
      }
    }
  9. def Stopped[T]: Behavior[T]

    Return this behavior from message processing to signal that this actor shall terminate voluntarily.

    Return this behavior from message processing to signal that this actor shall terminate voluntarily. If this actor has created child actors then these will be stopped as part of the shutdown procedure. The PostStop signal that results from stopping this actor will NOT be passed to the current behavior, it will be effectively ignored.

  10. def Unhandled[T]: Behavior[T]

    Return this behavior from message processing in order to advise the system to reuse the previous behavior, including the hint that the message has not been handled.

    Return this behavior from message processing in order to advise the system to reuse the previous behavior, including the hint that the message has not been handled. This hint may be used by composite behaviors that delegate (partial) handling to other behaviors.

  11. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  12. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  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. object Tap extends Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped