A - The type of the session identifierC - The type of the commandR - The type of the expected resultpublic class CommandCallbackWrapper<A,C,R> extends Object implements CommandCallback<C,R>
| Constructor and Description |
|---|
CommandCallbackWrapper(A channelId,
CommandMessage<C> message,
CommandCallback<? super C,R> callback)
Initializes a
CommandCallbackWrapper which wraps the original callback and holds on to the
command message and channelId of the channel on which the message is sent. |
| Modifier and Type | Method and Description |
|---|---|
void |
fail(Throwable e)
Invokes
CommandCallback.onFailure(CommandMessage, Throwable) with given exception on the wrapped
callback. |
A |
getChannelIdentifier()
Returns the identifier of the channel over which the command message was sent.
|
CommandMessage<C> |
getMessage()
Returns the command message that was sent.
|
void |
onFailure(CommandMessage<? extends C> message,
Throwable cause)
Invoked when command handling execution resulted in an error.
|
void |
onSuccess(CommandMessage<? extends C> message,
R result)
Invoked when command handling execution was successful.
|
void |
success(R result)
Invokes
CommandCallback.onSuccess(CommandMessage, Object) with given result on the wrapped
callback. |
public CommandCallbackWrapper(A channelId, CommandMessage<C> message, CommandCallback<? super C,R> callback)
CommandCallbackWrapper which wraps the original callback and holds on to the
command message and channelId of the channel on which the message is sent.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 receivedpublic CommandMessage<C> getMessage()
public A getChannelIdentifier()
public void fail(Throwable e)
CommandCallback.onFailure(CommandMessage, Throwable) with given exception on the wrapped
callback.e - cause for the failurepublic void success(R result)
CommandCallback.onSuccess(CommandMessage, Object) with given result on the wrapped
callback.result - the result of the commandpublic void onSuccess(CommandMessage<? extends C> message, R result)
CommandCallbackonSuccess in interface CommandCallback<C,R>message - The message that was dispatchedresult - The result of the command handling execution, if any.public void onFailure(CommandMessage<? extends C> message, Throwable cause)
CommandCallbackonFailure in interface CommandCallback<C,R>message - The message that was dispatchedcause - The exception raised during command handlingCopyright © 2010–2017. All rights reserved.