Skip to main content

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.

UpstreamDownstreamPattern (upstream side)Pattern (downstream side)ChannelStatusEvidence
inventory-storageorder-managementOpen Host Service, Published LanguageCustomer/Supplier, Anti-Corruption LayerREST POST /reservations, DELETE /reservations/{id}live with INVENTORY_STORAGE_MODE=httpoutbound/inventorystorage
product-masterorder-managementPublished LanguageAnti-Corruption Layer (local copy)Kafka warehouse.product-master.eventsopt-in, PRODUCT_CLASSIFICATION_MODE=kafka + PRODUCT_CLASSIFICATION_CONSUMER_GROUPinbound/kafka/product_classification_consumer.go, outbound/productclassificationcopy (ADR 0036)
order-managementwes-work-planningPublished Language (CloudEvents, apis/asyncapi.yaml)Conformist on the frozen four line fieldsKafka warehouse.order-management.eventslive with EVENT_PUBLISHER=kafkaoutbound/kafka.Publisher
process-path-managementorder-managementPublished LanguageAnti-Corruption Layer (local read model)Kafka warehouse.process-path-management.eventslive with PATH_CATALOGUE_SOURCE=kafkaoutbound/kafkacatalog, outbound/kafkacptschedule
wes-work-planningorder-managementPublished LanguageAnti-Corruption Layer (local read model)Kafka warehouse.work-planning.eventslive with PATH_CATALOGUE_SOURCE=kafkaoutbound/kafkapathcapacity
wes-work-planningorder-managementPublished LanguageAnti-Corruption Layer (confirmation of a release; reads only reference and line_no)Kafka warehouse.work-planning.events, WorkUnitCreatedopt-in, off by default: RELEASE_CONFIRMATION_MODE=kafka + RELEASE_CONFIRMATION_CONSUMER_GROUPinbound/kafka/release_confirmation_consumer.go (ADR 0043)
outbound-shippingorder-managementPublished LanguageAnti-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 PackageMissedLoadopt-in, off by default: OUTBOUND_SHIPPING_CONSUMER_MODE=kafka + OUTBOUND_SHIPPING_CONSUMER_GROUP; not enabled by the chart or by warehouse-infrainbound/kafka/outbound_shipping_consumer.go (ADR 0051)
fulfillment-executionorder-managementPublished LanguageAnti-Corruption LayerKafka warehouse.fulfillment.eventslive whenever KAFKA_BROKERS is setinbound/kafka/repromise_consumer.go
warehouse-planningorder-managementPublished LanguageAnti-Corruption Layer (local read model)Kafka warehouse.warehouse-planning.eventsopt-in, PLANNED_CAPACITY_CONSUMER_GROUPinbound/kafka/planned_capacity_consumer.go
order-managementnetwork-fulfillmentOpen Host Service (apis/openapi.yaml)Customer/Supplier; network-fulfillment is the ACL to the external networkREST POST /orders, POST /orders/{id}/releases, DELETE /orders/{id}liveADR 0020
order-managementwarehouse-ops-agent, order-mgmt-mfeOpen Host ServiceConformistREST, MCP get_orderliveADR 0007, ADR 0010
order-managementwes-work-planning (synchronous)——REST POST /paths/{pathId}/work-unitsdeliberately absent since ADR 0005ADR 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:

CallerCallNotes
warehouse-ops-agent console-bffGET /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):

CallRequestResponseUsed 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)​

TopicEvent types consumedAdapterPurpose
warehouse.process-path-management.eventsProcessPathCreated / Updated / Deactivatedoutbound/kafkacatalogLive catalogue + capability for path validation and promising (ADR 0013, 0014)
warehouse.process-path-management.eventsCPTScheduleChangedoutbound/kafkacptscheduleSite CPT schedule for the promise (ADR 0014)
warehouse.work-planning.eventsPathCapacityChangedoutbound/kafkapathcapacityRemaining path capacity per cutoff (ADR 0015)
warehouse.work-planning.eventsWorkUnitCreated (reference, line_no)inbound/kafka (ReleaseConfirmationConsumer)Confirms a released order line; opt-in, off by default (ADR 0043)
warehouse.outbound-shipping.eventsShipmentConfirmed (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.eventsTaskCPTMissed, PackageManifestedinbound/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.