I will describe my problem with a very typical example, an e-commerce application.
Says we have to manage Products
, and we have 2 bounded contexts Sales
, and Warehouse
that store the product information.
The Sales
bounded context cares about price, product name, description.
The Warehouse
bounded context cares about sizes, position, quantity, quality.
When we create a new product, we have to input all of the above information. Following the CQRS pattern, we have to send 2 commands Create Product
to Sales
and Warehouse
bounded context, which could be 2 microservices.
The problem is, if the Product
is created in Sales
, but not valid to be created in Warehouse
, or the command to Warehouse
is not sent, then the Product
in Sales
does not make sense. The same goes with the reverse.
So how do you create an object, in this case, a product, that appears in multiple bounded contexts?