In a correctly modeled CQRS domain, can a single command have multiple events?

Are there scenarios where a single command results in multiple events in CQRS? Can someone give an example for this?

I ask, because aggregates are transactional boundaries, and the implementation of the aggregate record depends on the answer to this question.

+4
source share
1 answer

Yes, for example, consider the AssignUserToGroup command. The domain logic checks whether some groups to which the user belongs are mutually exclusive with the new one, and if 2 events are published in this way: UserLeftTheGroup and UserEnteredTheGroup.

+7
source

Source: https://habr.com/ru/post/1523527/


All Articles