Error handling on EventHandler

Hello everybody

Is it possible to catch an error in an @EventHandler and bubbles it up to the @EventSourcingHandler, @CommandHandler and then catch it on the CommandGateway call?


By default, exceptions are logged in the event processor. However, it is possible to have them bubble up by configuring a PropagatingErrorHandler on your EventHandlerInvoker.

Note that this will only work when all messaging implementations run in the same thread (SimpleEventBus, SimpleCommandBus, SubscribingEventProcessor, etc). As soon as a single component in the chain is asynchronous, the behavior will change. It is therefore not considered good design to bubble exceptions up this way. But the choice is yours…



Thanks Allard