Interface QueryHandlingExceptionHandler
- All Superinterfaces:
MessageHandlingExceptionHandler<QueryMessage>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public interface QueryHandlingExceptionHandler
extends MessageHandlingExceptionHandler<QueryMessage>
Handles exceptions thrown by a
QueryHandler within a QueryHandlingComponent.
Return MessageStream.empty() to suppress the exception — the query returns no results. Return
MessageStream.failed(Throwable) (with the same or a different exception) to let the error propagate to the
caller. Return one or more QueryResponseMessage items to substitute results in place of the error.
Register via
QueryHandlingModule.QueryHandlerPhase.withExceptionHandler(org.axonframework.common.configuration.ComponentBuilder).
- Since:
- 5.2.0
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionhandle(QueryMessage query, ProcessingContext context, Throwable error) Called when a query handler throws an exception.
-
Method Details
-
handle
MessageStream<QueryResponseMessage> handle(QueryMessage query, ProcessingContext context, Throwable error) Called when a query handler throws an exception.- Specified by:
handlein interfaceMessageHandlingExceptionHandler<QueryMessage>- Parameters:
query- the query being handled when the exception occurredcontext- the active processing contexterror- the exception thrown by the query handler- Returns:
MessageStream.empty()to suppress the error,MessageStream.failed(Throwable)to propagate it, or a stream ofQueryResponseMessageitems to substitute results
-