Interface CommandHandlingExceptionHandler

All Superinterfaces:
MessageHandlingExceptionHandler<CommandMessage>
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 CommandHandlingExceptionHandler extends MessageHandlingExceptionHandler<CommandMessage>
Handles exceptions thrown by a CommandHandler within a CommandHandlingComponent.

Return MessageStream.empty() to suppress the exception. Return MessageStream.failed(Throwable) (with the same or a different exception) to let the error propagate to the caller. Return MessageStream.just(org.axonframework.messaging.core.Message) with a CommandResultMessage to substitute a result in place of the error.

The return type is MessageStream.Single because command handling always produces at most one result, matching the contract of CommandHandler.handle(CommandMessage, ProcessingContext).

Register via CommandHandlingModule.CommandHandlerPhase.withExceptionHandler(org.axonframework.common.configuration.ComponentBuilder).

Since:
5.2.0
Author:
Allard Buijze