Package org.axonframework.queryhandling
Class LoggingQueryInvocationErrorHandler
java.lang.Object
org.axonframework.queryhandling.LoggingQueryInvocationErrorHandler
- All Implemented Interfaces:
QueryInvocationErrorHandler
public class LoggingQueryInvocationErrorHandler
extends Object
implements QueryInvocationErrorHandler
Implementation of the QueryInvocationErrorHandler that logs all errors to a given
Logger.- Since:
- 3.1
- Author:
- Allard Buijze
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class to instantiate aLoggingQueryInvocationErrorHandler. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedInstantiate aLoggingQueryInvocationErrorHandlerbased on the fields contained in theLoggingQueryInvocationErrorHandler.Builder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Instantiate a Builder to be able to create aLoggingQueryInvocationErrorHandler.voidonError(Throwable error, QueryMessage<?, ?> queryMessage, MessageHandler messageHandler) Invoked when an error occurred while invoking a message handler in a scatter-gather query.
-
Constructor Details
-
LoggingQueryInvocationErrorHandler
Instantiate aLoggingQueryInvocationErrorHandlerbased on the fields contained in theLoggingQueryInvocationErrorHandler.Builder.- Parameters:
builder- theLoggingQueryInvocationErrorHandler.Builderused to instantiate aLoggingQueryInvocationErrorHandlerinstance
-
-
Method Details
-
builder
Instantiate a Builder to be able to create aLoggingQueryInvocationErrorHandler.The
Loggeris defaulted to aLoggerFactory.getLogger(Class)call usingLoggingQueryInvocationErrorHandler.class.- Returns:
- a Builder to be able to create a
LoggingQueryInvocationErrorHandler
-
onError
public void onError(@Nonnull Throwable error, @Nonnull QueryMessage<?, ?> queryMessage, @Nonnull MessageHandler messageHandler) Description copied from interface:QueryInvocationErrorHandlerInvoked when an error occurred while invoking a message handler in a scatter-gather query. Implementations may throw an exception to propagate the error to the caller. In that case, the QueryBus implementation will receive the exception, and may choose to propagate the error to the sender of the query.Note that this handler is not used for point-to-point queries. In that case, exceptions are reported directly to the invoker. Query Bus implementation may choose to implement point-to-point queries as scatter-gather, and only reporting the first answer returned. In that case, this method is invoked, and any propagated exceptions may or may not be reported to the sender of the query.
- Specified by:
onErrorin interfaceQueryInvocationErrorHandler- Parameters:
error- The error that occurredqueryMessage- The message causing the exception in the handlermessageHandler- The handler that reported the exception
-