Imagine that I am creating and Ecommerce application. For sake of simplicity, I will describe only 3 bounded contexts.
- Product Catalog: it's responsible for maintain product descriptions, characteristics and so on
- Pricing: it's responsible for products pricing
- Inventory: it's responsible for inventory management. If a product is in stock or not.
So when a customer just enter the Ecommerce site, I would like to show the products. For that I need to have the price and still needs to know that if we have the product in stock.
So what's is the best way to do that?
- First approach is the Product Catalog just make synchronous requests to Inventory and Pricing.
- Second approach is to maintain the price information and if the product has in stock on the Product Catalog BC. So every time a price is changed in Pricing Context it will raise and event and the Product Catalog can update this information. The same way for Inventory context.
I prefer the second approach, but it seems that I am replicating information e.g price and stock.