C
- The type of payload of the commandR
- The return value of the command handlerpublic class FailureLoggingCallback<C,R> extends Object implements CommandCallback<C,R>
CommandCallback
implementation wrapping another, that concisely logs failed commands. Since the full
exception is being reported to the delegate callback, the full stacktrace is not logged.Constructor and Description |
---|
FailureLoggingCallback(CommandCallback<C,R> delegate)
Initialize the callback to delegate calls to the given
delegate , logging failures on a logger
for this class (on warn level). |
FailureLoggingCallback(org.slf4j.Logger logger,
CommandCallback<C,R> delegate)
Initialize the callback to delegate calls to the given
delegate , logging failures on the given
logger (on warn level). |
Modifier and Type | Method and Description |
---|---|
void |
onFailure(CommandMessage<? extends C> commandMessage,
Throwable cause)
Invoked when command handling execution resulted in an error.
|
void |
onSuccess(CommandMessage<? extends C> commandMessage,
R result)
Invoked when command handling execution was successful.
|
public FailureLoggingCallback(CommandCallback<C,R> delegate)
delegate
, logging failures on a logger
for this class (on warn level).delegate
- The command callback to forward invocations topublic FailureLoggingCallback(org.slf4j.Logger logger, CommandCallback<C,R> delegate)
delegate
, logging failures on the given
logger
(on warn level).logger
- The logger to log exceptions ondelegate
- The command callback to forward invocations topublic void onSuccess(CommandMessage<? extends C> commandMessage, R result)
CommandCallback
onSuccess
in interface CommandCallback<C,R>
commandMessage
- The message that was dispatchedresult
- The result of the command handling execution, if any.public void onFailure(CommandMessage<? extends C> commandMessage, Throwable cause)
CommandCallback
onFailure
in interface CommandCallback<C,R>
commandMessage
- The message that was dispatchedcause
- The exception raised during command handlingCopyright © 2010–2018. All rights reserved.