Class CommandCallbackWrapper<A,C,R>
java.lang.Object
org.axonframework.commandhandling.distributed.CommandCallbackWrapper<A,C,R>
- Type Parameters:
A- The type of the session identifierC- The type of the commandR- The type of the expected result
- All Implemented Interfaces:
CommandCallback<C,R>
Wrapper for a Command callback. This is used in a CommandCallbackRepository
- Author:
- Koen Lavooij
-
Constructor Summary
ConstructorsConstructorDescriptionCommandCallbackWrapper(A channelId, CommandMessage<C> message, CommandCallback<? super C, ? super R> callback) Initializes aCommandCallbackWrapperwhich wraps the original callback and holds on to the commandmessageandchannelIdof the channel on which the message is sent. -
Method Summary
Modifier and TypeMethodDescriptionReturns the identifier of the channel over which the command message was sent.Returns the command message that was sent.voidonResult(CommandMessage<? extends C> message, CommandResultMessage<? extends R> commandResultMessage) Invoked when command handling execution is completed.voidreportResult(CommandResultMessage<R> result) InvokesCommandCallback.onResult(CommandMessage, CommandResultMessage)with givenresulton the wrapped callback.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.axonframework.commandhandling.CommandCallback
wrap
-
Constructor Details
-
CommandCallbackWrapper
public CommandCallbackWrapper(A channelId, CommandMessage<C> message, CommandCallback<? super C, ? super R> callback) Initializes aCommandCallbackWrapperwhich wraps the original callback and holds on to the commandmessageandchannelIdof the channel on which the message is sent.- Parameters:
channelId- used to identify the channel used to send the messagemessage- the command message that was sentcallback- the command callback to notify when the command result is received
-
-
Method Details
-
getMessage
Returns the command message that was sent.- Returns:
- the sent message
-
getChannelIdentifier
Returns the identifier of the channel over which the command message was sent.- Returns:
- the identifier of the channel over which the command message was sent
-
reportResult
InvokesCommandCallback.onResult(CommandMessage, CommandResultMessage)with givenresulton the wrapped callback.- Parameters:
result- the result of the command
-
onResult
public void onResult(@Nonnull CommandMessage<? extends C> message, @Nonnull CommandResultMessage<? extends R> commandResultMessage) Description copied from interface:CommandCallbackInvoked when command handling execution is completed.- Specified by:
onResultin interfaceCommandCallback<A,C> - Parameters:
message- theCommandMessagethat was dispatchedcommandResultMessage- theCommandResultMessageof the command handling execution
-