EDIT:EDIT 1: to answer the question you asked in a comment, syncing really depends on your actual architecture. I, for one, am really against pushing code out to external sources (e.g. triggers, batch jobs) if possible. I prefer the inverse: push all code as deep as possible into my own implementations (over which I have direct control). As stated, I'm using commands, events, and queries for data manipulation.
- Since we adhere to Command Query Separation, we can easily decorate point 2 with command authorisation, validation, logging, etc. without actually modifying the code in the Controller or the command handler.
- As you may have noticed, we struggle to keep parts of this subsystem as decoupled and testable as possible. Also, the concerns are blindingly separated.
EDIT 2: your question about "what if event handler dies" is gong to make
this a bit more complex, by introducing new concepts called Eventual consistency and message/event queueing. Quoting Greg Young:
On most systems you can just use a queue as the read system will want pretty much every event from the write system anyways.
This concept extends all above with:
- a place to store all events happened on write side
- have a queue that goes through these stored events and apply it to the read side