Package org.apache.pekko.actor.typed
Class BehaviorSignalInterceptor<Inner>
java.lang.Object
org.apache.pekko.actor.typed.BehaviorInterceptor<Inner,Inner>
org.apache.pekko.actor.typed.BehaviorSignalInterceptor<Inner>
- Type Parameters:
Inner- The inner message type - the type of message the wrapped behavior accepts
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 respective Behaviors.
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.actor.typed.BehaviorInterceptor
BehaviorInterceptor.PreStartTarget<T>, BehaviorInterceptor.ReceiveTarget<T>, BehaviorInterceptor.SignalTarget<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaroundReceive(TypedActorContext<Inner> ctx, Inner msg, BehaviorInterceptor.ReceiveTarget<Inner> target) Only signals and not messages are intercepted byBehaviorSignalInterceptor.aroundSignal(TypedActorContext<Inner> ctx, Signal signal, BehaviorInterceptor.SignalTarget<Inner> target) Intercept a signal sent to the running actor.Methods inherited from class org.apache.pekko.actor.typed.BehaviorInterceptor
aroundStart, interceptMessageClass, isSame
-
Constructor Details
-
BehaviorSignalInterceptor
public BehaviorSignalInterceptor()
-
-
Method Details
-
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:
aroundReceivein 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:
aroundSignalin classBehaviorInterceptor<Inner,Inner> - Returns:
- The behavior for next message or signal
- See Also:
-