I have the following domain modelling problem where I seem to end up either crossing consistency boundaries or creating a huge aggregate. Can someone help me break it up?
There are two job types JobA
, JobB
. JobA
is composed of tasks TaskA
. JobB
is composed of tasks TaskB
. JobA
and JobB
are unrelated. The only thing is common between them is that they both need an equipment resource. I had originally wanted to create 5 aggregate roots which may reference each other - JobA
will reference TaskA
and so on.
I can possibly put a job and its tasks in one aggregate. That comes at an expense of introducing other overhead as tasks themselves are complex creatures. However, the following constraints prevent me from using either model.
TaskA
and JobA
).Having a single aggregate will put all transactions inside the boundary but that will make the aggregate impossibly large. Is there a different model hidden in all this that I am missing?
I think the best solution could be using eventual consistency.
When I have doubts about designing agreggates I always take a look to Effective Agreggate Design by Vaughn Vernon.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With