Package akka.actor.typed
Class BehaviorSignalInterceptor<Inner>
- java.lang.Object
-
- akka.actor.typed.BehaviorInterceptor<Inner,Inner>
-
- akka.actor.typed.BehaviorSignalInterceptor<Inner>
-
- Type Parameters:
Inner
- The inner message type - the type of message the wrapped behavior accepts
public abstract class BehaviorSignalInterceptor<Inner> extends BehaviorInterceptor<Inner,Inner>
A behavior interceptor allows for intercepting signals reception and perform arbitrary logic - transform, filter, send to a side channel etc.The
BehaviorSignalInterceptor
API is considered a low level tool for building other features and shouldn't be used for "normal" application logic. Several built-in intercepting behaviors are provided through factories in the respectiveBehaviors
.If the interceptor does keep mutable state care must be taken to create a new instance from the factory function of
Behaviors.intercept
so that a new instance is created per spawned actor rather than shared among actor instance.- See Also:
BehaviorInterceptor
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class akka.actor.typed.BehaviorInterceptor
BehaviorInterceptor.PreStartTarget<T>, BehaviorInterceptor.ReceiveTarget<T>, BehaviorInterceptor.SignalTarget<T>
-
-
Constructor Summary
Constructors Constructor Description BehaviorSignalInterceptor()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Behavior<Inner>
aroundReceive(TypedActorContext<Inner> ctx, Inner msg, BehaviorInterceptor.ReceiveTarget<Inner> target)
Only signals and not messages are intercepted byBehaviorSignalInterceptor
.abstract Behavior<Inner>
aroundSignal(TypedActorContext<Inner> ctx, Signal signal, BehaviorInterceptor.SignalTarget<Inner> target)
Intercept a signal sent to the running actor.-
Methods inherited from class akka.actor.typed.BehaviorInterceptor
aroundStart, interceptMessageClass, isSame
-
-
-
-
Method Detail
-
aroundReceive
public final Behavior<Inner> aroundReceive(TypedActorContext<Inner> ctx, Inner msg, BehaviorInterceptor.ReceiveTarget<Inner> target)
Only signals and not messages are intercepted byBehaviorSignalInterceptor
.- Specified by:
aroundReceive
in classBehaviorInterceptor<Inner,Inner>
- Returns:
- The behavior for next message or signal
-
aroundSignal
public abstract Behavior<Inner> aroundSignal(TypedActorContext<Inner> ctx, Signal signal, BehaviorInterceptor.SignalTarget<Inner> target)
Intercept a signal sent to the running actor. Pass the signal on to the next behavior in the stack by passing it totarget.apply
.- Overrides:
aroundSignal
in classBehaviorInterceptor<Inner,Inner>
- Returns:
- The behavior for next message or signal
- See Also:
BehaviorSignalInterceptor
-
-