Class SignalHandlerBuilder<State>
- java.lang.Object
-
- akka.persistence.typed.state.javadsl.SignalHandlerBuilder<State>
-
public final class SignalHandlerBuilder<State> extends java.lang.Object
Mutable builder for handling signals inDurableStateBehavior
Not for user instantiation, use
DurableStateBehavior.newSignalHandlerBuilder
to get an instance.
-
-
Constructor Summary
Constructors Constructor Description SignalHandlerBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SignalHandler<State>
build()
static <State> SignalHandlerBuilder<State>
builder()
<T extends Signal>
SignalHandlerBuilder<State>onSignal(java.lang.Class<T> signalType, java.util.function.BiConsumer<State,T> callback)
If the behavior receives a signal of typeT
,callback
is invoked with the signal instance as input.<T extends Signal>
SignalHandlerBuilder<State>onSignal(T signal, java.util.function.Consumer<State> callback)
If the behavior receives exactly the signalsignal
,callback
is invoked.
-
-
-
Method Detail
-
builder
public static <State> SignalHandlerBuilder<State> builder()
-
onSignal
public <T extends Signal> SignalHandlerBuilder<State> onSignal(java.lang.Class<T> signalType, java.util.function.BiConsumer<State,T> callback)
If the behavior receives a signal of typeT
,callback
is invoked with the signal instance as input.
-
onSignal
public <T extends Signal> SignalHandlerBuilder<State> onSignal(T signal, java.util.function.Consumer<State> callback)
If the behavior receives exactly the signalsignal
,callback
is invoked.
-
build
public SignalHandler<State> build()
-
-