Taking a closer look at module integration
As I previously stated, all interactions between the modules are entirely synchronous and communicate via gRPC. With a distributed system such as our modular monolith application, there are two reasons that bounded contexts will need to integrate:
- They need data that exists in another bounded context
- They need another bounded context to perform an action
Using external data
When a bounded context needs data belonging to another bounded context, it has three options:
- Share the database where the data is stored
- Push the data from the owner to all interested components
- Pull the data from the owner when it is needed
The first option should be avoided in most situations, especially if changes are being made from more than one location. Rules surrounding invariants may not be implemented correctly or at all in every location.
When you push data out, you will be sending it to a list of known interested...