command-handler and exception in event-handler

When an exception occurs in event-handler, can that exception be
propagated to command-handler?



Hi Jamil,

when an event handler receives an event, the processing of the command handler is long finished. However, it is possible to have the Command Handler register a listener on the UnitOfWork that takes action when the UoW is rolled back. In the @CommandHandler methods, you can use a second parameter of type UnitOfWork or use the static CurrentUnitOfWork.get() method to obtain the UnitOfWork. Use the registerListener() method to register a listener.

Do note that this is considered bad design in general to solve issues. It relies on everything running synchronously. In general, once an Event is published, it should be considered gone. A listener that fails to process an Event should generally log that somewhere and continue processing.

Hope this helps.


Thank you for the clarification. I'll take of the exceptions in the
event-handler itself.