Class SignalHandlerBuilder<State>

  • public final class SignalHandlerBuilder<State>
    extends java.lang.Object
    Mutable builder for handling signals in EventSourcedBehavior

    Not for user instantiation, use EventSourcedBehavior.newSignalHandlerBuilder to get an instance.

    • Constructor Detail

      • SignalHandlerBuilder

        public SignalHandlerBuilder()
    • Method Detail

      • onSignal

        public <T extends SignalSignalHandlerBuilder<State> onSignal​(java.lang.Class<T> signalType,
                                                                       java.util.function.BiConsumer<State,​T> callback)
        If the behavior receives a signal of type T, callback is invoked with the signal instance as input.
      • onSignal

        public <T extends SignalSignalHandlerBuilder<State> onSignal​(T signal,
                                                                       java.util.function.Consumer<State> callback)
        If the behavior receives exactly the signal signal, callback is invoked.