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.
        Parameters:
        signalType - (undocumented)
        callback - (undocumented)
        Returns:
        (undocumented)
      • 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.
        Parameters:
        signal - (undocumented)
        callback - (undocumented)
        Returns:
        (undocumented)