Order Sourcing
Derived from network/model/model.yaml. This context's service is built; the model carries its as-built contracts, and identifiers (Err... names, routes, CloudEvents types) are the names the service uses. It also has an analytics read side (order-sourcing ADR 0013): cmd/os-projector projects this context's own topics into a separate analytical database, and cmd/os-reports serves the read-only /reports/... routes on :8092.
Order Sourcing (order-sourcing, code OS, CloudEvents tier commerce)
decides, as late as the promise allows, which node and path will actually
fulfil each shipment group of a customer order. It owns one aggregate,
FulfillmentAssignment. Assignments wait in a virtual queue where they
are re-optimised against current capacity and cost until their release point.
At release the group is sent to one vendor node, which for a vendor node means
a purchase order issued through vendor-connectivity. A rejection or an
expiry moves the group to another node. The node's acceptance locks the
assignment for good. When no node can still meet the promise's
deliverByLatest, the group becomes UNSOURCEABLE and goes back to
delivery-promise for a re-promise. Sourcing never breaks a promise silently.
Two operator levers sit on top. A versioned SourcingPolicy (a second, small aggregate)
adds a cross-region surcharge to the effective cost of a candidate and lets an in-region
candidate within a deviation percent of the cheapest win. And groups of one shopper and one
address that chose the opt-in CONSOLIDATED delivery day can be merged at release into one
carrier release with followers, when the policy allows it. Both are inert until a policy is
published: with no policy the ordering, the events and the views are unchanged.
- Inbound: nine Kafka topics of sibling contexts (orders, promises,
purchase-order outcomes, delivery, topology, availability, departures,
waves, scorecards) and a small REST surface for the network-ops planner
(
GET /assignments,GET /assignments/{assignmentId},POST /assignments/{assignmentId}/reoptimisations) and for the sourcing policy (GET /sourcing-policy,PUT /sourcing-policy). - Outbound: fifteen CloudEvents types: nine integration events
(
com.retailnetwork.commerce.order-sourcing.assignment.*, among them the consolidation eventFulfillmentReleaseWithdrawn) onretailnetwork.order-sourcing.events, and six analytics-only events (AssignmentsConsolidated,AssignmentsDeconsolidated, the policy eventSourcingPolicyPublishedand three of the assignment events) onretailnetwork.order-sourcing.analytics. No synchronous call to any other context (sync_calls: []). - Not here: the promise itself (Delivery Promise), the purchase-order protocol and its clock (Vendor Connectivity), and picking and packing, which the vendor does in its own building.
This context's pages
| Page | What it covers | ddd-crew tool it follows |
|---|---|---|
| Business Context | The sourcing problem in plain language, actors, decisions, the real fulfillment networks, scope | — (narrative) |
| Ubiquitous Language | Every term of this context and the neighbour terms it uses | glossary, from the DDD Starter Modelling Process (Define step) |
| Core Domain Chart | Why this context is Core | core-domain-charts |
| Bounded Context Canvas | Purpose, classification, roles, every inbound and outbound message, decisions, open questions | bounded-context-canvas v5 |
| Context Map | Every upstream and downstream neighbour with its pattern and channel | context-mapping |
| Aggregate Design Canvas | FulfillmentAssignment: states, invariants, policies, commands, events, read models | aggregate-design-canvas v1.1 |
| Domain Events | The 15 published events with data fields and consumers; the 34 consumed events | — (CloudEvents catalogue) |
| Domain Message Flow | Happy path, refusal and re-promise, cancellation, across contexts | domain-message-flow-modelling |
| EventStorming | Process-level boards with hotspots | eventstorming-glossary-cheat-sheet |
| Use Cases | One section per command: trigger, adapter, flow, errors, events, idempotency | — (application layer) |
| Class Diagram | Proposed domain classes and the hexagonal ports and adapters | — (UML) |
| Entity Relationship | Proposed Postgres schema, read-model and infrastructure tables | — (UML / ER) |
| Sequence Diagrams | One runtime sequence per command use case, with outbox and version checks | — (UML) |
The REST contract is apis/order-sourcing/openapi.yaml (proposed, OpenAPI
3.0.3), rendered under the API reference.
Service and operations
- Service:
IQVO/order-sourcingondevelop(62a2e03, 2026-10-26): binariescmd/api(REST) andcmd/mcp(read-only MCP), and the console remote inweb/. - Deployment: wired in warehouse-infra develop: a
terraform/apps.yamlentry (database: true,frontend_remote: order_sourcing_mfe) andhelm-values/order-sourcing.yaml(MCP enabled, gateway path/api/mcp/order-sourcing). The cluster itself was not checked in this refresh. - Observability: service ADR 0008,
Adopt the fleet observability standard, Accepted 2026-10-26. Logs, metrics and traces leave
over OTLP to the otel-collector (
OTEL_EXPORTER_OTLP_ENDPOINT, chart defaultotel-collector.observability.svc.cluster.local:4317;OTEL_SERVICE_NAME). The Tier-2 business counter issourcing.groups.sourced(unit{group}, ininternal/adapters/outbound/telemetry/sourcing_metrics.go), with attributeoutcome=queued,released,unsourceableorfailedandreasonon the outcomes that are not a success. The dashboard queries it assourcing_groups_sourced_totalin warehouse-infra'sterraform/dashboards/contexts/order-sourcing.json, byoutcome.
Elsewhere
- Read-only MCP server (service ADR 0006):
cmd/mcp, a second binary serving Streamable HTTP on:8090with no auth; it sources this context's own reads and nothing that writes. Two tools:get_assignment,list_assignments. The gateway (Kong) exposes it at/api/mcp/order-sourcing, rewritten to the server's/mcpmount. - Console remote (service ADR 0007):
web/, a Vite + React Module Federation remote — federation containerorder_sourcing_mfe, gateway mount/mfes/order-sourcing/, dev/preview port4019— read-only screens over the existing REST reads, calling only this context's API. - Order assignment model: the network-level worked example of queue, release, refusal and lock. This pack links to it rather than repeating it.
- ADR 0002: promise and assignment are separate and ADR 0005: vendor acceptance is the path lock.
- Strategic context map and subdomain classification.
- Event standard (CloudEvents).