I have two bounded contexts, Store and Inventory. The Store context has the Product aggregate, the Inventory context also have an aggregate called Product. Product is a different concept inside each context.
Now in my Store context I want this behavior in the products: "Please select the items from stock needed to sell this product". So in this case the user will select multiple products in different quantities from the Inventory context, with that information the Store context can tell if the product has enough stock to be sold.
If I am right, my bounded context should be independent, I can't just select things from my Inventory context database from inside the Store context. So I think maybe using events, when a product is added to the Inventory context the Store context will be listening and will add this product to its context too, with another name.
Some questions:
Is this the right approach? Using events to sync data between bounded contexts?
When inside Store context how can I name the Product from the Inventory context? Is there any convention for that?
Thanks!
Store
to be coupled (aware) ofInventory
BC and details, is declaring an interface withinStore
BC that outer layers must implement and inject following IoC. Whether the implementation of that interface gets the data from a remote service, Queue or from the DB is irrelevant forStore
BC