Replies: 1 comment 2 replies
-
In DDD, an aggregate always has all the information that applies to itself (if it doesn't, you have a bad aggregate design and need to re-work it). Therefore, the out-of-sync problem is never one that exists within the aggregate, but rather something that exists at the view level. In this situation, you would likely need to correct it by firing a new command at each aggregate. E.g.,
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following two aggregates:
So, there is essentially a one-to-many relationship between
User
andIdentity
. The code to create a new relationship between aUser
instance and anIdentity
instance could look something like this:It is technically possible that the resulting events of one of the commands fail to be applied or persisted, while the events of the other command are successfully handled. This would result in the application's state being incorrect, as the relationship between the instances would be incomplete. In relational databases, it is common to have the option of grouping multiple mutations into a single transaction. This ensures that the transaction will only be committed if all the mutations are successful. I was wondering if there is a similar concept in CQRS/ES. Or is there maybe a better way to model relationships between aggregates?
Beta Was this translation helpful? Give feedback.
All reactions