Skip to content

Aggregates delegating to other Aggregates #169

Answered by ar3s3ru
danieleades asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! Can you clarify what are you trying to do specifically? 😄

In general, Aggregates are supposed to be used only to maintain business invariants and represent transactional boundaries. A great resource on Aggregate modeling here: https://www.dddcommunity.org/library/vernon_2011/

One common thing is for Aggregates to depend on changes from other Aggregates. Example: an Order (aggregate 1) gets paid, so an Invoice (aggregate 2) needs to be created. In Event Sourcing (not just about this crate) one handles these cases using Process Managers.

A Process Manager is a component that listens to Domain Events and emits commands.

From the case above:

OrderEvent::WasPaid(x) -> InvocingProcessManag…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@danieleades
Comment options

@danieleades
Comment options

@ar3s3ru
Comment options

@danieleades
Comment options

@ar3s3ru
Comment options

Answer selected by danieleades
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants