Open kosletr opened 5 months ago
For example n com.saasovation.agilepm.application.team.TeamApplicationService.java
the method changeTeamMemberEmailAddress
modifies two aggregates, the ProductOwner
and the TeamMember
under the same transaction. Isn't this a violation of the rule of thumb?
For example n
com.saasovation.agilepm.application.team.TeamApplicationService.java
the methodchangeTeamMemberEmailAddress
modifies two aggregates, theProductOwner
and theTeamMember
under the same transaction. Isn't this a violation of the rule of thumb?
Two reasons:
ProductOwner
or a TeamMember
updated, never both in the same transaction. The incoming event message from the Identity and Access Context doesn't contain a role name, just the user's email address. I decided to query both even though only one will be found, in order to simplify the single application service method. See: https://github.com/VaughnVernon/IDDD_Samples/blob/9b27b11773f62afb5d1b541abf51fb36516a7250/iddd_agilepm/src/main/java/com/saasovation/agilepm/port/adapter/messaging/sloth/SlothMQTeamMemberEmailAddressChangedListener.java#L51ProductOwner
and TeamMember
roles, there would never be a collision. (I don't recall if there is a business rule to prevent one user playing multiple team roles.)HTH.
Hello! I really enjoyed the book and the papers. I have a question. As you also mentioned in the Effective Aggregate Design Part I: Modeling a Single Aggregate paper, a rule of thumb says that we should be limiting the modification of one aggregate per transaction. I am wondering why though? How does this rule of thumb help us? Why not persist two aggregates in the database under the same transaction? Thanks!