abstract class BehaviorInterceptor[O, I] extends AnyRef

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. Many built-in intercepting behaviors are provided through factories in the respective Behaviors.

If the interceptor does keep mutable state care must be taken to create the instance in a setup block so that a new instance is created per spawned actor rather than shared among actor instance.

O

The outer message type – the type of messages the intercepting behavior will accept

I

The inner message type - the type of message the wrapped behavior accepts

Source
BehaviorInterceptor.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. BehaviorInterceptor
  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

Instance Constructors

  1. new BehaviorInterceptor()

Abstract Value Members

  1. abstract def aroundReceive(ctx: TypedActorContext[O], msg: O, target: ReceiveTarget[I]): Behavior[I]

    Intercept a message sent to the running actor.

    Intercept a message sent to the running actor. Pass the message on to the next behavior in the stack by passing it to target.apply, return Behaviors.same without invoking target to filter out the message.

    returns

    The behavior for next message or signal

  2. abstract def aroundSignal(ctx: TypedActorContext[O], signal: Signal, target: SignalTarget[I]): Behavior[I]

    Intercept a signal sent to the running actor.

    Intercept a signal sent to the running actor. Pass the signal on to the next behavior in the stack by passing it to target.apply.

    returns

    The behavior for next message or signal

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 BehaviorInterceptor[O, I] to any2stringadd[BehaviorInterceptor[O, I]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (BehaviorInterceptor[O, I], B)
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to ArrowAssoc[BehaviorInterceptor[O, I]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def aroundStart(ctx: TypedActorContext[O], target: PreStartTarget[I]): Behavior[I]

    Override to intercept actor startup.

    Override to intercept actor startup. To trigger startup of the next behavior in the stack, call target.start().

    returns

    The returned behavior will be the "started" behavior of the actor used to accept the next message or signal.

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  9. def ensuring(cond: (BehaviorInterceptor[O, I]) ⇒ Boolean, msg: ⇒ Any): BehaviorInterceptor[O, I]
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to Ensuring[BehaviorInterceptor[O, I]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  10. def ensuring(cond: (BehaviorInterceptor[O, I]) ⇒ Boolean): BehaviorInterceptor[O, I]
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to Ensuring[BehaviorInterceptor[O, I]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: Boolean, msg: ⇒ Any): BehaviorInterceptor[O, I]
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to Ensuring[BehaviorInterceptor[O, I]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean): BehaviorInterceptor[O, I]
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to Ensuring[BehaviorInterceptor[O, I]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to StringFormat[BehaviorInterceptor[O, I]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  16. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. def interceptMessageType: Class[_ <: O]

    Allows for applying the interceptor only to certain message types.

    Allows for applying the interceptor only to certain message types. Useful if the official protocol and the actual protocol of an actor causes problems, for example class cast exceptions for a message not of type O that the actor still knows how to deal with. Note that this is only possible to use when O and I are the same type.

    returns

    A subtype of O that should be intercepted or null to intercept all Os. Subtypes of O matching this are passed directly to the inner behavior without interception.

  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def isSame(other: BehaviorInterceptor[Any, Any]): Boolean

    returns

    true if this behavior logically the same as another behavior interceptor and can therefore be eliminated (to avoid building infinitely growing stacks of behaviors)? Default implementation is based on instance equality. Override to provide use case specific logic.

  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  25. def toString(): String
    Definition Classes
    AnyRef → Any
  26. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  28. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  29. def [B](y: B): (BehaviorInterceptor[O, I], B)
    Implicit
    This member is added by an implicit conversion from BehaviorInterceptor[O, I] to ArrowAssoc[BehaviorInterceptor[O, I]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from BehaviorInterceptor[O, I] to any2stringadd[BehaviorInterceptor[O, I]]

Inherited by implicit conversion StringFormat from BehaviorInterceptor[O, I] to StringFormat[BehaviorInterceptor[O, I]]

Inherited by implicit conversion Ensuring from BehaviorInterceptor[O, I] to Ensuring[BehaviorInterceptor[O, I]]

Inherited by implicit conversion ArrowAssoc from BehaviorInterceptor[O, I] to ArrowAssoc[BehaviorInterceptor[O, I]]

Ungrouped