Class FailureLoggingCallback<C,R>
java.lang.Object
org.axonframework.commandhandling.callbacks.FailureLoggingCallback<C,R>
- Type Parameters:
C- The type of payload of the commandR- The return value of the command handler
- All Implemented Interfaces:
CommandCallback<C,R>
A
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 Summary
ConstructorsConstructorDescriptionFailureLoggingCallback(CommandCallback<C, R> delegate) Deprecated.FailureLoggingCallback(org.slf4j.Logger logger) Initialize the callback to log failures on the givenlogger(on warn level).FailureLoggingCallback(org.slf4j.Logger logger, CommandCallback<C, R> delegate) Deprecated.Please useCommandCallback.wrap(CommandCallback)to wrap a command with a delegate and use theFailureLoggingCallback(Logger)to specify you custom logger. -
Method Summary
Modifier and TypeMethodDescriptionvoidonResult(CommandMessage<? extends C> commandMessage, CommandResultMessage<? extends R> commandResultMessage) Invoked when command handling execution is completed.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
-
FailureLoggingCallback
public FailureLoggingCallback(org.slf4j.Logger logger) Initialize the callback to log failures on the givenlogger(on warn level).- Parameters:
logger- The logger to log exceptions on
-
FailureLoggingCallback
Deprecated.Please useCommandCallback.wrap(CommandCallback)to wrap a command with a delegate and use theFailureLoggingCallback(org.slf4j.Logger, org.axonframework.commandhandling.CommandCallback<C, R>)to create this callbackInitialize the callback to delegate calls to the givendelegate, logging failures on a logger for this class (on warn level).- Parameters:
delegate- The command callback to forward invocations to
-
FailureLoggingCallback
@Deprecated public FailureLoggingCallback(@Nonnull org.slf4j.Logger logger, @Nonnull CommandCallback<C, R> delegate) Deprecated.Please useCommandCallback.wrap(CommandCallback)to wrap a command with a delegate and use theFailureLoggingCallback(Logger)to specify you custom logger.Initialize the callback to delegate calls to the givendelegate, logging failures on the givenlogger(on warn level).- Parameters:
logger- The logger to log exceptions ondelegate- The command callback to forward invocations to
-
-
Method Details
-
onResult
public void onResult(@Nonnull CommandMessage<? extends C> commandMessage, @Nonnull CommandResultMessage<? extends R> commandResultMessage) Description copied from interface:CommandCallbackInvoked when command handling execution is completed.- Specified by:
onResultin interfaceCommandCallback<C,R> - Parameters:
commandMessage- theCommandMessagethat was dispatchedcommandResultMessage- theCommandResultMessageof the command handling execution
-
CommandCallback.wrap(CommandCallback)to wrap a command with a delegate and use theFailureLoggingCallback(org.slf4j.Logger, org.axonframework.commandhandling.CommandCallback<C, R>)to create this callback