Eventual consistency and 1 to n relationships
"dirk g [email protected] [domaindrivendesign]" <[email protected]> Wed, 10 Jan 2018 10:32:34 -0700 (MST)
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <[email protected]> |
Hi, In my domain I have Product and Order aggregates. Orders reference Products. This is a 1 to n relationship, so a Product has many Orders and Orders belong to a Product. When a Product is discontinued a ProductDiscontinued event is published and all Orders that belong to this Product must be cancelled. So there's an adapter that receives the ProductDiscontinued event via RabbitMQ. The adapters then delegates cancelling Orders to an application service. How can I achieve that a single Order is cancelled in a single transaction? Should the adapter iterate over all Orders for the discontinued Product and call the application service for every single Order? Should I just ignore that I modify more than one aggregate in a single transaction and call the application service just once with a list of all affected OrderIds? Or is there a better solution? Many thanks, Dirk -- Sent from: http://domain-driven-design.3010926.n2.nabble.com/ ------------------------------------ Posted by: dirk g <[email protected]> ------------------------------------ ------------------------------------ Yahoo Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/domaindrivendesign/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/domaindrivendesign/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo Groups is subject to: https://info.yahoo.com/legal/us/yahoo/utos/terms/