Skip to main content

Domain Message Flow Modelling

This page follows ddd-crew's Domain Message Flow Modelling. It traces the platform's key business scenarios across bounded-context boundaries. The per-context pages show one context's view. This page joins them into end-to-end flows.

Notation. Participants are bounded contexts, people and external systems. Every arrow is numbered and prefixed:

  • cmd: is a command, a request to change state: a REST write, an MCP write tool or a port call to the external network.
  • qry: is a query, a request for data: a REST GET or an MCP read tool.
  • evt: is a domain event, a fact published as a CloudEvents 1.0 message on Kafka. Open arrowheads (-)) mark asynchronous Kafka hops. The topic is named in the message or in a note.

Inside the diagrams, event names are shortened to their last type segment. The full type is com.warehouse.<wms|wes>.<bounded-context>.<entity>.<EventName> (see the Event Standard). Replies are folded into notes, so that every arrow is a domain message.

Sources. Every message comes from a synced spec (apis/<context>/openapi.yaml, apis/<context>/asyncapi.yaml) or from that context's own code-grounded Domain Message Flow page. Those pages are linked under each scenario. The diagrams leave out the transactional-outbox relay hop and the analytics copy that every producer also writes to its warehouse.<ctx>.analytics topic.

Integration topics at a glance​

Only the integration topics are listed. The *.analytics topics feed each context's own projector and are never read by a sibling.

TopicProducerEvent types consumed by a siblingConsumers
warehouse.order-management.eventsorder-managementOrderAllocated, OrderPartiallyAllocatedwes-work-planning, warehouse-planning
SiteSkuDemandChangednetwork-inventory-planning, slotting-optimization
warehouse.inventory.eventsinventory-storageStockReserved, ReservationRevokedwes-work-planning
StockRelocated (from POST /relocations and from a completed RELOCATE task)slotting-optimization (plan execution progress; only reason SLOTTING executes a plan move); pick-face-replenishment (acts only on reason REPLENISHMENT, which inventory-storage records for a completed REPLENISH task)
BinStockLevelChanged (absolute per-bin level, key <bin>:<sku>)pick-face-replenishment (deployed)
TransferStockAllocated, TransferStockAllocationRejected, TransferReceiptStaged, TransferStockStowednetwork-inventory-planning
legacy ProductClassified (emitted only by the one-shot backfill)product-master's legacy importer (migration only, removed at stage E)
warehouse.work-planning.eventswes-work-planningWorkReleased (including RELOCATE work for slot-plan moves and, since wes-work-planning's ADR 0042, REPLENISH work with its additive replenishment object; the REPLENISH work exists only when the opt-in REPLENISHMENT_MODE=kafka consumer runs, which warehouse-infra develop sets, helm-values/wes-work-planning.yaml, K44)fulfillment-execution
PathCapacityChangedorder-management, network-fulfillment
warehouse.fulfillment.eventsfulfillment-executionTaskCompleted (RELOCATE tasks add sku, from_bin, to_bin, quantity, relocation_ref; REPLENISH tasks add the same plus request_ref)wes-work-planning, labor-performance, inventory-storage (picks, RELOCATE and REPLENISH moves); task-interleaving; warehouse-planning (observed capacity, its ADR 0017, K49)
TaskAvailable (RELOCATE and REPLENISH tasks only), TaskClaimedtask-interleaving (deployed)
TransferPicked, TransferDispatched, TransferArrivednetwork-inventory-planning
TaskCPTMissed, PackageManifestedorder-management
warehouse.workforce.eventsworkforce-managementShiftPlanCommittedwes-work-planning, warehouse-planning
warehouse.labor-performance.eventslabor-performanceTaskPerformanceRecordedworkforce-management
LaborStandardDefined, LaborStandardRevised (ADR 0038)warehouse-planning (labour requirement, its ADR 0022)
warehouse.process-path-management.eventsprocess-path-managementProcessPathCreated, ProcessPathUpdated, ProcessPathDeactivatedfulfillment-execution, wes-work-planning, workforce-management, order-management, network-fulfillment
CPTScheduleChangedorder-management, network-fulfillment
warehouse.facility.eventsfacility-layoutZoneRegistered, LocationSlotRegistered, LocationSlotDecommissionedinventory-storage (all three), warehouse-planning and inbound-receiving (the two slot events); slotting-optimization (all three); pick-face-replenishment (all three)
LocationGeometryUpdatedtask-interleaving (with the three above)
SiteCapabilityChangednetwork-inventory-planning
warehouse.warehouse-planning.eventswarehouse-planningCapacityPlanCreated, CapacityPlanPublished, CapacityShortageDetectedorder-management (BottleneckDetected is ignored); CapacityPlanPublished also network-inventory-planning
CapacityPlanSupersededorder-management (terminal SUPERSEDED status, never constrains; its ADR 0052)
LabourPlanCommittedworkforce-management (local copy; its ADR 0043)
WorkloadForecastReceived, LabourPlanDriftDetectedno sibling consumer (analytics copies only)
warehouse.network-fulfillment.eventsnetwork-fulfillmentnoneno consumer (wired but unused)
warehouse.network-inventory-planning.eventsnetwork-inventory-planningTransferAllocationRequestedinventory-storage
WorkDemandReleasedwes-work-planning
warehouse.product-master.eventsproduct-masterProductClassifiedinventory-storage, order-management, wes-work-planning, fulfillment-execution (local copies); slotting-optimization
ProductRegisteredinbound-receiving (local copy of known SKUs)
ProductDimensionsDeclared, ProductMeasuredslotting-optimization
ProductPackLevelDeclared, ProductPackLevelRetiredinbound-receiving, inventory-storage, pick-face-replenishment, slotting-optimization, wes-work-planning, fulfillment-execution, network-inventory-planning (local pack views, K62)
ProductPackLevelMeasuredwes-work-planning, slotting-optimization (K62)
warehouse.inbound-receiving.eventsinbound-receivingReceiptLineReceivedinventory-storage (its ADR 0037)
CartonDiscrepancyRaisedexception-management (its ADR 0006, K66)
DockAppointmentBooked, DockAppointmentCheckedIn, DockAppointmentCancelled, DockAppointmentCompletedretired (stage E, inbound-receiving ADR 0022, on develop 2026-11-10): no longer declared or published. warehouse-planning read the first and third under its ADR 0017 until its ADR 0020 switched the source to dock-scheduling (K28)
warehouse.slotting-optimization.eventsslotting-optimizationSlotPlanApprovedwes-work-planning (one RELOCATE work unit per move, its ADR-0040); pick-face-replenishment (forward map)
warehouse.pick-face-replenishment.eventspick-face-replenishmentReplenishmentRequestedwes-work-planning (one REPLENISH work unit per request, its ADR 0042; opt-in, and REPLENISHMENT_MODE=kafka is set in the reference deployment, K44)
ReplenishmentCancelledwes-work-planning (cancels the unit only while it is still Pending, same opt-in)
ReplenishmentCompletednone (wes-work-planning reads the topic and ignores it)
warehouse.task-interleaving.eventstask-interleavingInterleavingHintIssuedfulfillment-execution (advisory tie-break inside one claimNext priority band, its ADR 0051, K47)
warehouse.returns-processing.eventsreturns-processingReturnLineStagedinventory-storage (its ADR 0044, K53)
UnexpectedReturnReceivedexception-management (K54)
warehouse.outbound-shipping.eventsoutbound-shippingShipmentConfirmed, PackageMissedLoadorder-management (its ADR 0051, K72; wired-but-unused: both ends run — outbound-shipping applied to k3s on 2026-11-12 — but order-management's consumer is dark and no OUTBOUND_SHIPPING_* variable is set for it)
PackageMissedLoadexception-management (its ADR 0011, K73; wired-but-unused: the consumer group is wired in infra, the producer is not applied)
warehouse.exception-management.eventsexception-managementall seven typesnone

Several published types have no sibling consumer today. These are five of the eight warehouse.work-planning.events types (all but WorkReleased, PathCapacityChanged and WorkUnitCreated, which order-management reads only with RELEASE_CONFIRMATION_MODE=kafka; for example WorkUnitCompleted; the charge forecast, shift plan and drift events were retired with ADR 0049 and now live in warehouse-planning), BottleneckDetected, TransferPlanApproved, every warehouse.network-fulfillment.events type, ProductDescriptionChanged, every warehouse.inbound-receiving.events type except ReceiptLineReceived, CartonDiscrepancyRaised (K66; the four dockappointment types are retired, ADR 0022) (the yard section's own readers of the rest are on the yard section context map), SlotPlanGenerated and SlotPlanRejected on warehouse.slotting-optimization.events, and ReplenishmentCompleted on warehouse.pick-face-replenishment.events. No scenario below traverses the inbound-receiving, slotting-optimization, pick-face-replenishment, task-interleaving, returns-processing, exception-management or outbound-shipping rows yet (the slot-plan execution chain is the sequence on the slotting-optimization sequence diagrams). They are listed as hotspots on Big Picture EventStorming. warehouse-ops-agent has no Kafka I/O at all. It issues qry: messages over MCP and REST, and its two human-confirmed act slices send a cmd: to the owning context over A2A (see the Context Map).

1. Network order intake and acceptance​

The external retail network's purchase order becomes a held order in order-management. It is released to the floor only after the network confirms our acceptance.

Rejection branches: an untranslatable product leads to NetworkOrderRejected UNTRANSLATABLE_SKU, with no call to order-management. A null promiseDate leads to DELETE /orders/{id}, then NetworkOrderRejected INFEASIBLE_DEADLINE. A FAILURE on reconcile leads to DELETE /orders/{id}, then NetworkOrderRejected SUBMISSION_FAILED. Each rejection is followed by SubmitAcknowledgement accepted false, except SUBMISSION_FAILED.

Sources: network-fulfillment flows 1 and 2, order-management flow 2, inventory-storage flow 1, warehouse-planning flow 2.

2. Order allocation to released work​

A direct-channel order allocates and releases in one request. Release is choreographed. order-management does not call wes-work-planning. It announces released lines on OrderAllocated, and wes-work-planning derives one WorkUnit per line, with the id orderId-line-n.

OrderPartiallyAllocated takes the place of OrderAllocated when a partial-shipment order releases only some lines. A ship-complete order with a backordered line releases nothing. POST /paths/{pathId}/work-units is a REST alternative to the Kafka enqueue. Neither order-management nor wes-work-planning asks another context for a SKU's classification at request time: each reads a local copy fed by product-master's ProductClassified (scenario 10), with PRODUCT_CLASSIFICATION_MODE=kafka in the reference deployment. The binary default, permissive, reads no copy and adds no hint.

Sources: order-management flow 1, wes-work-planning scenario 1, inventory-storage flow 1, wes-work-planning context map.

3. Execution: pick, rebin, pack, SLAM and the completion loop​

fulfillment-execution dispatches by pull. A station claims the next earliest-CPT task it is equipped for. TaskCompleted closes the WIP loop in wes-work-planning and feeds labor-performance. PackageManifested reaches order-management.

Outside the 5 % weight tolerance, the package is DIVERTED. That raises WeightDiscrepancyDetected and PackageDiverted on the analytics topic only, and nothing reaches order-management. No sibling calls inventory-storage's POST /reservations/{id}/pick-confirmations. The physical pick therefore never consumes the reservation in the live flow. Only the e2e-tests simulator calls it.

Sources: fulfillment-execution scenarios 1 and 2, wes-work-planning context map, "The loop", labor-performance flow 1, inventory-storage context map.

4. Shipment confirmation back to the network​

The network order is closed by an explicit shipment confirmation, which an operator or an upstream caller sends. It is not derived from PackageManifested. network-fulfillment keeps no mapping from a work unit or package to a NetworkRef, and its ADR 0014 records that choice.

The synced apis/network-fulfillment/openapi.yaml does not yet list the shipment-confirmation route. It is drawn here from the context's code-grounded flow page. NetworkOrderShipmentConfirmed has no Kafka consumer in the fleet.

Sources: network-fulfillment flow 1, network-fulfillment EventStorming, section 3, network-fulfillment context map.

5. CPT miss and re-promise​

The CPT (Critical Pull Time) is a site's carrier cutoff. An external scheduler drives fulfillment-execution's sweep. Every open task at or past its CPT is reported, and order-management recomputes the affected line's shipment-group promise from its local read models.

Nothing in fulfillment-execution runs the sweep on a timer. The same overdue task is reported again on every later pass. order-management dedupes on the CloudEvents id and sends a message to the DLQ after three failed attempts.

Sources: order-management flow 3, fulfillment-execution scenario 3, process-path-management flow 3.

6. Capacity planning feed​

Three planning signals feed promising. warehouse-planning composes planned capacity from labor, stations and demand. wes-work-planning publishes remaining path capacity. network-fulfillment turns both stock and remaining capacity into a capability offer. Planned capacity only annotates an order. It never moves a promise (order-management ADR 0031).

GET /orders/{id} carries a capacityConstraint when the order's promise overlaps a published shortage. The capability offer is computed only when CAPABILITY_OFFER_ENABLED=true. It is readable through GET /capability-offers and the MCP tool list_capability_offers, but is not yet submitted to the network: SubmitAvailability is unused. That route is also missing from the synced network-fulfillment openapi.yaml. warehouse-ops-agent reads get_process_path_capacity over MCP for its daily brief.

Sources: warehouse-planning flows 1 to 3, order-management flow 4, wes-work-planning scenario 3, network-fulfillment flow 4.

7. Staffing and labor feedback​

Measured performance flows back into staffing proposals, and committed staffing flows forward into release planning and capacity planning. Moving people stays a human decision.

labor-performance makes no REST or MCP call to a sibling. It only consumes TaskCompleted. The measured-rate feed into workforce-management uses Kafka when LABOR_PERFORMANCE_MODE=kafka-cache. The REST client for GET /task-types/{taskType}/performance is still wired as the alternative. wes-work-planning no longer publishes a ShiftPlanCommitted: its own com.warehouse.wes.work-planning.plan.ShiftPlanCommitted, the charge forecast and PathPlanDriftDetected were retired when the requirement side of planning moved to warehouse-planning (wes-work-planning ADR 0049). The labour plan is now LabourPlanCommitted, and its drift LabourPlanDriftDetected, both from warehouse-planning; the only ShiftPlanCommitted left is workforce-management's.

Sources: labor-performance flow 1, workforce-management flows 1, 2 and 4, wes-work-planning scenario 2, warehouse-planning flow 1, warehouse-ops-agent flow 2.

8. Facility layout changes​

facility-layout is the source of truth for physical structure. Its events maintain local caches in inventory-storage and a station tally in warehouse-planning. Other contexts query it only on demand.

inventory-storage checks a stow against its cache only when LOCATION_LOOKUP_MODE=kafka. With http, it calls GET /locations/{locationCode}/classification instead. The default, permissive, enforces no placement rule. Decommission is one-way. Re-registering the code returns 409.

Sources: facility-layout flows 1 to 4, inventory-storage flow 3, inventory-storage EventStorming.

9. Process-path catalogue propagation​

process-path-management defines the canonical process paths. Five contexts replay its events into a local catalogue cache. None of them calls it synchronously.

wes-work-planning and workforce-management read the topic only with PATH_CATALOGUE_SOURCE=kafka. Their default is a YAML file. warehouse-planning does not consume these events. Its ProcessPath is a different, locally declared model (see Ubiquitous Language).

Sources: process-path-management flows 1 and 2, workforce-management flow 4, wes-work-planning context map.

10. Product master data propagation​

product-master is the single source of truth for what a SKU is. A steward registers and classifies a product there. Four contexts keep a local, version-guarded copy of the classification. Nobody calls product-master at request time, and product-master calls nobody.

inventory-storage answers its old PUT /products/{sku}/classification with 410 (classification-moved) and keeps applying hazmat placement and DOT segregation at stow time from its copy. During the migration, product-master's legacy importer also reads inventory-storage's legacy ProductClassified from warehouse.inventory.events, which only the one-shot republish-product-classifications backfill still emits; both are removed at stage E (product-master ADR 0003).

Sources: product-master domain message flow, product-master Async API, product-master context map, warehouse-ops-agent context map.

11. Inter-warehouse transfer​

network-inventory-planning keeps local copies of three siblings' facts. An operator approves a transfer, and a saga carries it through reservation, floor work and destination stow. NIP never moves stock: inventory-storage reserves and stows, fulfillment-execution reports the physical steps, and wes-work-planning turns released demands into work.

An allocation refusal (TransferStockAllocationRejected) ends the saga in UNFULFILLABLE and releases no work. TransferArrived is reserved and may never fire, because TransferReceiptStaged drives the same arrival. The dispatch leg needs a transfer-dispatch path in the process-path catalogue; the reference deployment's own comment says it is not seeded. The read-only transfer watch of warehouse-ops-agent reads the result over MCP (find_stuck_transfers).

Sources: network-inventory-planning domain message flow, network-inventory-planning Async API, network-inventory-planning context map.