-2

I want to design my project in DDD spirit. This is single aplication (not microservices) but with separate BC (as modules). Each BC have separate mongoDB collection. I have problem with communication between bounded contexts inside single application. If two BC want to save some data into different collection. It may be some consistency problem. Do somebody know how to resolve this problem?

3

If two BC want to save some data into different collection. It may be some consistency problem. Do somebody know how to resolve this problem?

The usual solution is to stop expecting that the two copies of the data will always be consistent.

Instead, we pay more attention to authority (who controls the "real" data?), and caching (how old is this copy?).

When two copies of the data MUST be synchronized, we design the system such that the two different use cases are in the same BC, and therefore share the same copy of the data.

There is no "magic" - data consistency is one of the things you give up when you start distributing the use of that data.

  • One single source of truth. Many records of what that single source of truth once was. – candied_orange Oct 3 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.