General question: Who is responsible for handling events included in a single command?
Simplified example
Two aggregates are given: User
and Game
.
To start a Game
with the StartGame
-command, both User
s have to accept. In terms of my domain-driven solution this results in the following event-flow: GameRequested
-> UserAccepted
or UserRejected
-> GameStarted
or GameFailed
.
This event flow and the corresponding business logic code is part of the domain, hence I want to stipulate that behavior in the domain layer. But often I see that the application layer does all of that event handling and executing behavior on the aggregates to bridge the gap. Is the application layer really responsible for determining which aggregate has to be called (and how) next for proceeding this GameStart
-command procedure (spanning multiple aggregates and events)?