Hi Guys,
Have an interesting challenge on how to model Commands with 4 eyes principle enabled, i.e. when the same action should be approved by a second person (i.e. Checker) before it gets executed. I think of two ways to implement that, e.g.
1) Maker initiates PostJournalEntry command
2) Whenever the PostJournalEntry requires checker, the command goes into PENDING CHECK state (validated in command handler)
3) Checker sees the command in the inbox and checks / approves it
4) Command gets delivered to the handler for execution
The issue with this approach is that the "intent" to approve the action is not captured as a separate command and the initial command is broken into two actions.
Second option would be to implement two separate commands for each action, i.e. InitiateJournalEntryPost and ApproveJournalEntryPost, but this approach would move the complexity to keep intermediate state of the "command" into each an every domain, whilst in fact, domain is not concerned whenever the action itself was approved or not. Moreover, the idea is to keep this concern on the upper level of the architecture to make it generic for all type of actions, without the need to model it and maintain in every domain separately.
Any thoughts would be highly appreciated.
Thanks,
Ben