The diagram below is a simplified view of our CQRS/ES application architecture. It’s pretty straightforward thanks to Axon. The basic message flow is user agent REST API request -> send domain command -> handle command -> dispatch domain event -> project event to JSON. The JSON is then read by the API in response to separate REST requests from user agents.
I’m considering deploying the Domain and Projection components together in the same JVM (so a cluster of servers each with domain+projection) instead of using a distributed event bus.
- All commands for a given aggregate ID will be sent to the same node. I can then configure an Axon local event bus so that events for a given aggregate ID will be projected in the order that they were dispatched from the domain, right?
- What would be the local event bus configuration options to make sure that the projection event handler executes asynchronously? Or is that the responsibility of the event handler itself?
- Apart from losing a level of control over balancing the processing load due to combining domain and projection on the same node, are there other factors that would make the a distributed event bus better?