Interface CommandCallback<C,R>
- Type Parameters:
C- the type of payload of the commandR- 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.
Interface describing a callback that is invoked when command handler execution has finished.
- Since:
- 0.6
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionvoidonResult(CommandMessage<? extends C> commandMessage, CommandResultMessage<? extends R> commandResultMessage) Invoked when command handling execution is completed.default CommandCallback<C, R> wrap(CommandCallback<C, R> wrappingCallback) Wraps the command callback with another using aWrappedCommandCallback.
-
Method Details
-
onResult
void onResult(@Nonnull CommandMessage<? extends C> commandMessage, @Nonnull CommandResultMessage<? extends R> commandResultMessage) Invoked when command handling execution is completed.- Parameters:
commandMessage- theCommandMessagethat was dispatchedcommandResultMessage- theCommandResultMessageof the command handling execution
-
wrap
Wraps the command callback with another using aWrappedCommandCallback. 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
WrappedCommandCallbackrepresenting the execution of both callbacks - Since:
- 4.6.0
-