I’m quite new to ES, but have been doing DDD for a long time. I recently started working on a project that uses Axon and found a practice that, in my eyes, makes the system a lot more rigid and more difficult to reason about.
We have some commands and events wrapping other events.
- Usually the Sagas wrap events into commands to dispatch to an aggregate. In this way, the piece of code that creates the event, has knowledge of what the events final aggregate expects. This feels like crossing an abstraction / responsibility boundary.
- Some sagas start other sages, for these ‘child’ sagas to communicate back, they create events wrapping other events. These Russian doll events go first to the initial saga to do any required processing and then are used as in the scenario above (command nesting events).
Is this a standard, well understood practice with Axon/ES? Is it a recognised bad practice? or Is it something to (maybe) do in some very specific cases.
An unfortunate consequence of this, is that tests have more complex setup and assertions as there’s extra data flowing in and out of the sagas & aggregates.