The behavior of my systems, is as follows
- user places an order for a product
1a. order management creates a placeholder record for the order
1b. forwards the order to an external vendor. - external vendor fills the order and also say ships it for delivery
2a. then returns my system back a list of filled orders only end of day with the tracking ids for shipments - my system needs to update the placeholder record with the filled order details and the user details*
Another important aspect is that we are bulk ordering stock from external vendor. In consequence it can happen that an order placed was cancelled by user A during the day but purchased by user B
So there is a mechanism in place to findlastUser()
for this order in place.
Say the business now has a hard requirement to keep a central bounded context, named FilledOrderHistory
which will be a single Source Of Truth (SOT) for fetching order related data, and separate Bounded Contexts for Orders & Shipments.
So for data flow, I am considering these 2 options:
Option A: enrich and write
external Vendor data --writes--> BC FilledOrderHistory (SEQID, external_order_id)
Enrichment of data A)
BC FilledOrderHistory (SEQID, external_order_id) --read--> Unique Identifier for Order from BC Orders & map it to BC FilledOrderHistory using some translation rules
B)BC FilledOrderHistory (SEQID, external_order_id) --read--> Unique Identifier for User from BC Users & map it to BC FilledOrderHistory
BC FilledOrderHistory (SEQID, external_order_id) writes a record in a datastore for (SEQID, external_order_id,internal_orderId,internal_userId)
Option B: read and enrich
external Vendor data --writes--> BC FilledOrderHistory (SEQID, external_order_id)
At the time of read, fetch all projections from each BC . other BC will maintain the mapping & translations.
return a record for (SEQID, external_order_id,internal_orderId,internal_userId) `
Challenge: possibility that there could be a new BC in future, say Shipment Tracking for tracing each order with tracking id details as provided in vendor data, and say handle any complaints relating to it.
Question: How do I model the bounded contexts communication? I know that I need to introduce the ACL's but what's the pattern which allow me most flexibility.