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

StackOverflow https://stackoverflow.com/questions/21333888

  •  02-10-2022
  •  | 
  •  

문제

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

I'm asking because aggregates are transactional boundaries, and the implementation of writing an aggregate depends on the answer to this question.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top