1

Say I have an Aggregate call JobSeeker and another one that is called ResumeBank that contains a collection of resumes and is associated with a JobSeeker.

The business problem: When I create a JobSeeker I also need to create a ResumeBank that is associated with that JobSeeker.

Should I create a Domain Service that orchestrates this or should I use eventual consistency?

Mike Lenart
  • 767
  • 1
  • 5
  • 19
  • Hi Mike. What are the benefits of creating a Domain Service vs using eventual consistency? – CPerson Mar 10 '20 at 17:07
  • Even if you create a Domain Service, they still remain eventually consistent if they are two separate aggregates as you specified. Could you rephrase the question pls? – DmitriBodiu Mar 10 '20 at 17:53
  • Yes my question is should I create a Domain Service to make two calls: First to create the JobSeeker aggregate and the second to create the ResumeBank with the JobSeeker ID? Or do I have the ResumeBank aggregate subscribe to a "JobSeekerCreated" event and create the ResumeBank from there? – Mike Lenart Mar 11 '20 at 00:32

1 Answers1

0

maybe you can define your JobSeeker aggregate as a root aggregate and use a repository to manage the consistency.

A nice post explains those notions post

Elviro
  • 1
  • 4
  • The JobSeeker is the Aggregate Root for the JobSeeker aggregate and the ResumeBank is the Aggregate Root for a separate aggregate. – Mike Lenart Jul 27 '20 at 00:44