Interface CommandCallback<C,R>

Type Parameters:
C - the type of payload of the command
R - the type of result of the command handling
All Known Implementing Classes:
BlacklistDetectingCallback, CommandCallbackWrapper, FailureLoggingCallback, FutureCallback, LoggingCallback, MonitorAwareCallback, NoOpCallback, ResultValidatorImpl, RetryingCallback, WrappedCommandCallback
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CommandCallback<C,R>
Interface describing a callback that is invoked when command handler execution has finished.
Since:
0.6
Author:
Allard Buijze
  • Method Details

    • onResult

      void onResult(@Nonnull CommandMessage<? extends C> commandMessage, @Nonnull CommandResultMessage<? extends R> commandResultMessage)
      Invoked when command handling execution is completed.
      Parameters:
      commandMessage - the CommandMessage that was dispatched
      commandResultMessage - the CommandResultMessage of the command handling execution
    • wrap

      default CommandCallback<C,R> wrap(CommandCallback<C,R> wrappingCallback)
      Wraps the command callback with another using a WrappedCommandCallback. If provided with a null callback this method will not wrap it, keeping the original callback instead.

      In effect, the given callback will be executed first, and then the original will be executed second. You can wrap callback as many times as you'd like.

      Parameters:
      wrappingCallback - The command callback that should wrap the current instance
      Returns:
      The WrappedCommandCallback representing the execution of both callbacks
      Since:
      4.6.0