Context Map
Order Management is the platform's upstream front door for demand. Its
integrations today are a mix of synchronous HTTP it calls (inventory-
storage), Kafka it publishes (release choreography, re-promise,
analytics), Kafka it consumes (capability, schedule, capacity and
fulfillment facts from three sibling contexts) and inbound HTTP callers
(the console, its own MFE, and network-fulfillment).
The platform, with this context's edges highlighted
Bold edges are synchronous HTTP; thin edges are Kafka topics; the dashed
warehouse-planning edge is opt-in (PLANNED_CAPACITY_CONSUMER_GROUP), and so
is the dashed product-master edge (PRODUCT_CLASSIFICATION_MODE=kafka); dashed
teal edges are the read-mostly console callers (see
ADR-0007). Only the
Kafka edges this context itself publishes or consumes are drawn — the other
services' topics among themselves are out of scope for this page. The
analytics topic warehouse.order-management.analytics is consumed only by
this repo's own cmd/order-projector, so it is not a context edge.
Relationship patterns (ddd-crew)
Source: internal/adapters/outbound/{inventorystorage,productclassificationcopy,kafka,kafkacatalog,kafkacptschedule,kafkapathcapacity},
internal/adapters/inbound/{kafka,http,mcp}, cmd/order/main.go.
Omits: the analytics topic (internal to this repo), the
OrderRepromised integration event (published; exception-management consumes it to auto-resolve open exception cases), the
SiteSkuDemandChanged projection (ADR 0035, opt-in via
DEMAND_PROJECTION_SITE_ID; slotting-optimization and network-inventory-planning consume it), and the
CloudEvents type prefix on every Kafka label (com.warehouse.wms.product-master.
for product-master, com.warehouse.wes.<context>. for the others).
Arrows point from upstream to downstream; id and sku stand for the path
parameters.
| Upstream | Downstream | Pattern (upstream side) | Pattern (downstream side) | Channel | Status | Evidence |
|---|---|---|---|---|---|---|
| inventory-storage | order-management | Open Host Service, Published Language | Customer/Supplier, Anti-Corruption Layer | REST POST /reservations, DELETE /reservations/{id} | live with INVENTORY_STORAGE_MODE=http | outbound/inventorystorage |
| product-master | order-management | Published Language | Anti-Corruption Layer (local copy) | Kafka warehouse.product-master.events | opt-in, PRODUCT_CLASSIFICATION_MODE=kafka + PRODUCT_CLASSIFICATION_CONSUMER_GROUP | inbound/kafka/product_classification_consumer.go, outbound/productclassificationcopy (ADR 0036) |
| order-management | wes-work-planning | Published Language (CloudEvents, apis/asyncapi.yaml) | Conformist on the frozen four line fields | Kafka warehouse.order-management.events | live with EVENT_PUBLISHER=kafka | outbound/kafka.Publisher |
| process-path-management | order-management | Published Language | Anti-Corruption Layer (local read model) | Kafka warehouse.process-path-management.events | live with PATH_CATALOGUE_SOURCE=kafka | outbound/kafkacatalog, outbound/kafkacptschedule |
| wes-work-planning | order-management | Published Language | Anti-Corruption Layer (local read model) | Kafka warehouse.work-planning.events | live with PATH_CATALOGUE_SOURCE=kafka | outbound/kafkapathcapacity |
| wes-work-planning | order-management | Published Language | Anti-Corruption Layer (confirmation of a release; reads only reference and line_no) | Kafka warehouse.work-planning.events, WorkUnitCreated | opt-in, off by default: RELEASE_CONFIRMATION_MODE=kafka + RELEASE_CONFIRMATION_CONSUMER_GROUP | inbound/kafka/release_confirmation_consumer.go (ADR 0043) |
| outbound-shipping | order-management | Published Language | Anti-Corruption Layer (ship confirmation and missed-load re-promise; reads only load_id, orders[].order_id, source_order_id and cutoff) | Kafka warehouse.outbound-shipping.events, ShipmentConfirmed and PackageMissedLoad | opt-in, off by default: OUTBOUND_SHIPPING_CONSUMER_MODE=kafka + OUTBOUND_SHIPPING_CONSUMER_GROUP; not enabled by the chart or by warehouse-infra | inbound/kafka/outbound_shipping_consumer.go (ADR 0051) |
| fulfillment-execution | order-management | Published Language | Anti-Corruption Layer | Kafka warehouse.fulfillment.events | live whenever KAFKA_BROKERS is set | inbound/kafka/repromise_consumer.go |
| warehouse-planning | order-management | Published Language | Anti-Corruption Layer (local read model) | Kafka warehouse.warehouse-planning.events | opt-in, PLANNED_CAPACITY_CONSUMER_GROUP | inbound/kafka/planned_capacity_consumer.go |
| order-management | network-fulfillment | Open Host Service (apis/openapi.yaml) | Customer/Supplier; network-fulfillment is the ACL to the external network | REST POST /orders, POST /orders/{id}/releases, DELETE /orders/{id} | live | ADR 0020 |
| order-management | warehouse-ops-agent, order-mgmt-mfe | Open Host Service | Conformist | REST, MCP get_order | live | ADR 0007, ADR 0010 |
| order-management | wes-work-planning (synchronous) | — | — | REST POST /paths/{pathId}/work-units | deliberately absent since ADR 0005 | ADR 0005 |
No Shared Kernel and no Partnership: no Go code or schema is shared with any sibling context (ADR 0002). Every downstream decode lands in a struct local to the adapter.
warehouse-planning (Kafka, inbound, opt-in — ADR 0031)
inbound/kafka.PlannedCapacityConsumer reads
CapacityPlanCreated (stored as DRAFT), CapacityPlanPublished and
CapacityShortageDetected (stored as PUBLISHED) and
CapacityPlanSuperseded (stored as a terminal SUPERSEDED row that never
annotates an order, ADR 0052) into
planned_capacity_windows. The read model only annotates order responses
with a capacityConstraint and backs GET /planned-capacity; no promise
moves and nothing is published back. Enabled only when
PLANNED_CAPACITY_CONSUMER_GROUP is set; failures go to
warehouse.warehouse-planning.events.dlq.
product-master (Kafka, inbound, opt-in — ADR 0036)
inbound/kafka.ProductClassificationConsumer applies
com.warehouse.wms.product-master.product.ProductClassified into
product_classification_copy (one row per SKU, applied only when the
event's version is greater than the stored one); every other
product-master type is ignored. ReceiveOrder reads the copy through
ports.ProductClassificationLookup to evaluate path eligibility; an unknown
SKU fails open. Enabled with PRODUCT_CLASSIFICATION_MODE=kafka and a
stable PRODUCT_CLASSIFICATION_CONSUMER_GROUP; this replaced the live
GET /products/{sku}/classification call to inventory-storage.
Console callers (ADR-0007)
Per ADR-0007, this
context adopted the fleet-wide micro-frontend console architecture defined in
warehouse-ops-agent's own ADR-0002. Two inbound HTTP callers exist as a
result, both hitting endpoints that already existed:
| Caller | Call | Notes |
|---|---|---|
warehouse-ops-agent console-bff | GET /orders/{id} | First hop of the cross-cutting Order Lifecycle screen's fan-out. No new endpoint — the BFF already has the order id and calls this service's existing aggregate-root lookup. |
order-mgmt-mfe (this repo's web/) | POST /orders, GET /orders/{id}, DELETE /orders/{id} | This context's own Module Federation remote: one screen with an order-intake form and a look-up/cancel panel. |
Enabling both required adding go-chi/cors middleware to this service's
existing HTTP adapter (CORS_ALLOWED_ORIGINS, additive, no gateway) — the
only backend change this adoption required.
This service's edges
→ inventory-storage (live, synchronous HTTP)
Customer/Supplier. Order Management is the Customer; inventory-storage
is the Supplier / Open Host Service
(internal/adapters/outbound/inventorystorage, INVENTORY_STORAGE_MODE +
INVENTORY_STORAGE_BASE_URL):
| Call | Request | Response | Used by |
|---|---|---|---|
POST /reservations | {"sku":"...","quantity":N,"demandRef":"..."} (this order's OrderId as demandRef), header Idempotency-Key: res-{orderId}-line-{n}-att-{version} (ADR 0028) | 201: {"id":"...","sku":"...","quantity":N,"demandRef":"...","status":"...","allocations":[...],"expiresAt":"..."} | allocateAndRelease (from ReceiveOrder, RetryAllocation, ReleaseHeldOrder reconfirm) |
DELETE /reservations/{id} | — | 204 (200 and 404 also count as revoked) | CancelOrder |
A 409 from POST /reservations means insufficient usable stock and maps
to Backordered for that line; any other non-2xx status or a transport
error propagates as a hard failure — never silently treated as
backordered.
Product classification for eligibility-driven path selection
(ADR 0016) is
no longer read from inventory-storage: since
ADR 0036 it comes from a
local copy of product-master's ProductClassified events (see above). It
still fails open: an unknown SKU only drops a routing hint and never
rejects intake.
→ wes-work-planning (Kafka choreography, no HTTP)
Since ADR 0005 this
service no longer calls wes-work-planning at all. Release is announced as
OrderAllocated/OrderPartiallyAllocated on
warehouse.order-management.events (when EVENT_PUBLISHER=kafka), and
wes-work-planning's own consumer reconstructs the deterministic work-unit id
{orderId}-line-{lineNo} from the payload. See
Domain Events for the frozen payload.
By default nothing comes back: release is fire-and-forget. With
RELEASE_CONFIRMATION_MODE=kafka (ADR 0043,
available, off by default) this service reads wes-work-planning's existing
WorkUnitCreated (see the inbound table below) to confirm each released
line, and flags one that is never confirmed with the analytics-only
OrderReleaseUnconfirmed. It is not a reply event and not a call, and
nothing is cancelled, re-released or retried on a timeout.
← process-path-management, wes-work-planning, fulfillment-execution, outbound-shipping (Kafka, inbound)
| Topic | Event types consumed | Adapter | Purpose |
|---|---|---|---|
warehouse.process-path-management.events | ProcessPathCreated / Updated / Deactivated | outbound/kafkacatalog | Live catalogue + capability for path validation and promising (ADR 0013, 0014) |
warehouse.process-path-management.events | CPTScheduleChanged | outbound/kafkacptschedule | Site CPT schedule for the promise (ADR 0014) |
warehouse.work-planning.events | PathCapacityChanged | outbound/kafkapathcapacity | Remaining path capacity per cutoff (ADR 0015) |
warehouse.work-planning.events | WorkUnitCreated (reference, line_no) | inbound/kafka (ReleaseConfirmationConsumer) | Confirms a released order line; opt-in, off by default (ADR 0043) |
warehouse.outbound-shipping.events | ShipmentConfirmed (load_id, orders[].order_id), PackageMissedLoad (source_order_id, cutoff) | inbound/kafka (OutboundShippingConsumer) | Ships the named orders' Released lines; re-promises an order whose package missed its load; opt-in, off by default (ADR 0051) |
warehouse.fulfillment.events | TaskCPTMissed, PackageManifested | inbound/kafka (RepromiseConsumer) | Re-promise loop, raises OrderRepromised (ADR 0018) |
The first three are local caches rebuilt by full replay under a
per-process-unique consumer group, enabled only by
PATH_CATALOGUE_SOURCE=kafka (default none, in which case the promise
always falls back to LeadTimePolicy). The re-promise consumer uses a
stable shared group (order-management-repromise) and runs whenever
KAFKA_BROKERS is set. The release-confirmation consumer uses its own
stable group (RELEASE_CONFIRMATION_CONSUMER_GROUP, no default) and runs
only with RELEASE_CONFIRMATION_MODE=kafka; poison goes to
warehouse.work-planning.events.dlq. The outbound-shipping consumer uses its
own stable group (OUTBOUND_SHIPPING_CONSUMER_GROUP, no default) and runs only
with OUTBOUND_SHIPPING_CONSUMER_MODE=kafka; poison goes to
warehouse.outbound-shipping.events.dlq.
← network-fulfillment (inbound HTTP, ADR 0020)
network-fulfillment is the anti-corruption layer to an external retail
fulfillment network. Its internal/adapters/outbound/ordermanagement
client raises a held order (releaseOnAllocation: false,
allowPartialShipment: false, requiredShipBy = the network's deadline)
via POST /orders, reads an absent promiseDate as "cannot meet the
deadline", and later commits with POST /orders/{id}/releases or rejects
with DELETE /orders/{id}. Network vocabulary (PO, ASIN, acknowledgement)
and customer PII stay on its side of the boundary — see
ADR 0020.
What this context explicitly does NOT do
- Imports no Go code from any sibling context. This is a separate Go module in a separate repository. Every inbound Kafka payload is decoded into this repo's own local struct.
- Has no write access to other contexts' aggregates —
Reservation,WorkPool,WorkUnit, etc. — only to their published HTTP/Kafka contracts above. - Has no database access to any other context's schema.
The only piece of Supplier state this context retains is the
ReservationId reference, held solely so CancelOrder can call
DELETE /reservations/{id} later. See
ADR 0002
for the full reasoning behind this boundary.
Failure-mode discipline (MODE=http|permissive)
The inventory-storage reservation client follows the fleet's env-selected
MODE=http|permissive pattern, defaulting to permissive so unit tests
never hit the network. The classification lookup
(PRODUCT_CLASSIFICATION_MODE=kafka|permissive, ADR 0036) fails open like
the rest of the fleet's soft lookups. The reservation client does not:
allocating real stock must never silently "succeed" against a no-op, so in
permissive mode allocation returns ErrDownstreamNotConfigured (503
downstream-not-configured). Only http mode is suitable for any real
integration test or deployment.