The user has just created the product, and now expects to be able to add that product to their stores.
- Allow the product to be added regardless.
- The store service not having the product in its cache consults the source of truth.
- Reject the request till such time as the system synchronises.
Off the bat option 3, is what you already have.
Option 2 is what you are currently thinking. In terms of viability it depends.
- You are adding an extra dependency, and volume which the event store was presumable meant to avoid.
- On the other hand only new products would cause the store to query the products service. Deleted and amended products would be updated via the events system so in terms of volume it might be sustainable.
- It will necessarily introduce some extra lag in when adding new products to a store, will this be a usability/user experience concern?
Option 1 uses the client as a pseudo event store by forwarding the product details via the client to the store when a product is created.
- You can achieve some reasonability here by signing those details.
- ensure that any internal confidential data isn't sent via the client (even if encrypted).
- The event store will complete/verify the product information
- The Store has no direct dependency on the product service
- There is an increase in external bandwidth dependent on the number of new products.
I would lean toward option 1 instead of option 2 in the majority of cases. The exceptions would be when the data needed shouldn't be passed through a hostile environment.
As for the viability of Option 2 you will need metrics, and probably some extra measures around service reliability.
Why not simply pass a list of stores that the product should be added too?
When the user flags
AddToAllStores the UI they are using should translate that to a list of all of their stores.
This translates the global knowledge problem of what does
AddToAllStores mean, to the local knowledge problem of just
these, stores, to, the, letter.
You will of course still need to do the translation but the right place for translation is properly in the input system be that a batch data-loading process or a human UI.