core-java
core-java copied to clipboard
Eliminate responsibility duplication when handling a rejection
When a command is rejected, two mutually exclusive scenarios are possible. It is not clear, how they differ.
The scenarios are:
-
CommandErrorHandler
catches the rejection, posts it to theRejectionBus
and never updates the command status. This seems to be the incorrect scenario. -
or
CommandBus
catches the rejection, posts it to theRejectionBus
and does update a command status.
The first scenario happens when a command is dispatched through the EntityMessageEndpoint
and the command handler generates a rejection.
The second scenario happens when:
- a command is dispatched through the
EntityMessageEndpoint
but aCommandRoute
generates a rejection (that is before the command handler is called); - a command is dispatched through any custom
CommandDispatcher
;