Warehouse execution (WES) · Generic/Supporting domain · EventStorming board
order-management
Takes customer orders, reserves stock for every line, promises a ship date and releases the work. It also holds orders for other contexts and re-promises when plans slip.
- events published
- 12
- commands
- 12
- policies
- 19
- read models
- 6
- hot spots
- 5
The story in 4 key events
The pivotal events: the few that matter most, in the order they happen.
- Pivotal eventOrder
Received - Pivotal eventOrder
Allocated - Pivotal eventOrder
Released - Pivotal eventOrder
Repromised
Listens to (6): contexts whose events this one reacts to
Tells (7): contexts that react to its events
The board, row by row
15 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.
- Event
- Command
- Actor
- Aggregate
- Policy
- Read model
- External system
- Hot spot
- Opportunity
-
Keep the product classification copy
product-master classifies each product (handling tags, temperature, hazard class). A local copy lets intake pick a process path without a live call. This runs only when switched on.
Systemproduct-master EventProductClassified PolicyWhenever a product is classified, keep its newest classificationCommandApplyProduct started by the policyClassification Read model · kept up to dateProduct classification copySource: application/usecases/product_classification.go · adapters/inbound/kafka/product_classification_consumer.go
-
Keep the process paths and cutoffs copy
process-path-management announces process paths and the cutoff schedule. A local copy lets intake choose a path and promise a cutoff without a live call.
Systemprocess-path- management EventCPTScheduleChanged PolicyWhenever a path or its cutoff schedule changes, update the local copyCommandApplyCPTSchedule started by the policyChanged Read model · kept up to dateProcess paths and cutoffsSource: adapters/outbound/kafkacatalog/consumer.go · adapters/outbound/kafkacptschedule/consumer.go
-
Keep the path capacity copy
wes-work-planning says how much work each path can still take before each cutoff. A local copy lets the promise avoid cutoffs that are already full.
Systemwes-work- planning EventPathCapacity Changed PolicyWhenever a path's remaining capacity changes, update the local copyCommandApplyPath started by the policyCapacity Changed Read model · kept up to dateRemaining path capacity -
Keep the planned capacity copy
warehouse-planning publishes capacity plans and shortages. A local copy lets an order response show which shortage windows overlap its promise. It changes no promise.
Systemwarehouse-planning EventCapacityPlan Published PolicyWhenever a capacity plan or shortage is published, store its window; a draft never overwrites a published oneCommandApplyPlanned started by the policyCapacity Read model · kept up to datePlanned capacity windowsSource: application/usecases/planned_capacity.go · adapters/inbound/kafka/planned_capacity_consumer.go
-
Take an order and release it
The order is saved and every line gets a stock reservation. A ship date is promised from the paths' cutoffs. Reserved lines are released as work, so the customer gets a promise at once.
ActorCustomer channelRead modelProduct classification copyRead modelProcess paths and cutoffsRead modelRemaining path capacityCommandReceiveOrder POST /ordersAggregateOrderEventOrderReceived analytics stream onlyEventOrderLine analytics stream onlyAllocated EventOrderAllocated EventOrderLine analytics stream onlyReleased EventOrderReleased analytics stream onlySystemwes-work- planning PolicyTurns each released line into a work unit on its process pathSystemreturns-processing PolicyKeeps a copy of the allocated lines for later return checksSystemwarehouse-planning PolicyAdds the order to its expected demandSource: application/usecases/receive_order.go · application/usecases/allocation.go · application/usecases/allocation_events.go · domain/order/order.go
-
Take an order that cannot be fully reserved
A line with too little stock is backordered and the pass goes on. A ship-complete order releases nothing until every line is reserved. If inventory-storage fails part-way, what was reserved is kept and the failure is reported.
ActorCustomer channelRead modelProduct classification copyRead modelProcess paths and cutoffsRead modelRemaining path capacityCommandReceiveOrder POST /ordersAggregateOrderEventOrderReceived analytics stream onlyEventOrderLine analytics stream onlyAllocated EventOrderLine analytics stream onlyBackordered EventOrderPartially Allocated EventOrderAllocation analytics stream onlyPartially Failed Systemwes-work- planning PolicyCreates work only for the lines that were releasedSource: application/usecases/receive_order.go · application/usecases/allocation.go · adr/0003-ship-complete-default-and-fail-closed-allocation.md
-
Retry a stuck allocation
An operator retries the backordered lines of an order. Lines that can now be reserved are reserved and released. Unlike intake, a hard failure here is returned to the operator.
ActorOperatorCommandRetryAllocation POST /orders/{id}/allocation-retriesAggregateOrderEventOrderLine analytics stream onlyAllocated EventOrderLine analytics stream onlyBackordered EventOrderAllocated EventOrderPartially Allocated EventOrderLine analytics stream onlyReleased EventOrderReleased analytics stream onlyEventOrderAllocation analytics stream onlyPartially Failed Systemwes-work- planning PolicyTurns each newly released line into a work unitSource: application/usecases/retry_allocation.go · application/usecases/allocation.go
-
Hold an order for another context
A calling context asks for stock held, not released, with a ship-by time and a fulfillment site. The order must be ship-complete. It gets a promise date, or none if the deadline cannot be met.
ActorNetwork order callerRead modelProcess paths and cutoffsRead modelRemaining path capacityCommandReceiveOrder POST /ordersAggregateOrderEventOrderReceived analytics stream onlyEventOrderLine analytics stream onlyAllocated EventOrderAllocated EventSiteSku Demand Changed Systemnetwork-inventory- planning PolicyKeeps the line's demand at its site in a local copySource: application/usecases/receive_order.go · application/usecases/demand_projection.go · adr/0020-network-originated-demand-hold-and-deadline-feasibility.md · adr/0044-caller-assigned-fulfillment-site-on-the-order.md
-
Release a held order
The caller decides to go ahead. Reservations are checked again, because they can lapse. The reserved lines are released as work, and a ship-complete order releases nothing if a line was lost.
ActorNetwork order callerRead modelOrder view with promise dateCommandReleaseHeld POST /orders/{id}/releasesOrder AggregateOrderEventOrderLine analytics stream onlyBackordered EventOrderAllocated EventOrderPartially Allocated EventOrderLine analytics stream onlyReleased EventOrderReleased analytics stream onlySystemwes-work- planning PolicyTurns each released line into a work unit on its process pathSource: application/usecases/release_held_order.go · application/usecases/allocation.go · adr/0020-network-originated-demand-hold-and-deadline-feasibility.md
-
Cancel an order
Reservations are given back and every line is cancelled. It is refused once any line has been released, and nothing is changed in that case.
ActorCustomer channelCommandCancelOrder DELETE /orders/{id}AggregateOrderEventOrderCancelled analytics stream onlyEventSiteSku Demand Changed Systemnetwork-inventory- planning PolicyDrops the cancelled lines from its demand copy, for orders with a siteSystemslotting-optimization PolicyDrops the cancelled lines from its demand copy, for orders with a siteSource: application/usecases/cancel_order.go · domain/order/order.go · adr/0004-cancellation-boundary-at-release.md
-
Re-promise when a task misses its cutoff
fulfillment-execution reports a task past its cutoff, or a package manifested. The promise of that line's shipment group is worked out again. A new event is raised only if the promise moved.
Systemfulfillment-execution EventTaskCPTMissed PolicyWhenever a task misses its cutoff, work out the promise of its shipment group againRead modelProcess paths and cutoffsRead modelRemaining path capacityCommandRepromiseOrder started by the policyAggregateOrderEventOrderRepromised EventSiteSku Demand Changed Systemexception-management PolicyCloses the open exceptions it matches to this orderSource: application/usecases/repromise_order.go · adapters/inbound/kafka/repromise_consumer.go · adr/0018-repromise-order-consumer-and-order-repromised.md
-
Re-promise when a package misses its load
outbound-shipping reports a package that missed its load. Every shipment group of that order is promised again. Each group whose promise moved raises its own event. This runs only when switched on.
Systemoutbound-shipping EventPackageMissed Load PolicyWhenever a package misses its load, work out the promise of every group of its order againRead modelProcess paths and cutoffsRead modelRemaining path capacityCommandRepromiseOrder started by the policyAggregateOrderEventOrderRepromised Source: application/usecases/repromise_order_missed_load.go · adapters/inbound/kafka/outbound_shipping_consumer.go · adr/0051-consume-shipment-confirmed-and-package-missedload.md
-
Mark lines shipped when the load leaves
outbound-shipping reports a load as shipped, naming its orders. Released lines of those orders become shipped. The result stays a local fact. This runs only when switched on.
Systemoutbound-shipping EventShipmentConfirmed PolicyWhenever a load is confirmed shipped, mark the released lines of its orders as shippedCommandConfirmShipment started by the policyAggregateOrderSource: application/usecases/confirm_shipment.go · adapters/inbound/kafka/outbound_shipping_consumer.go · adr/0051-consume-shipment-confirmed-and-package-missedload.md
-
Confirm a release from the work unit
When work is released, a pending confirmation is opened per line. wes-work-planning's work unit for that line settles it. This runs only when switched on, and is off by default.
Systemwes-work- planning EventWorkUnit Created PolicyWhenever a work unit is created for a released line, mark that line's release confirmedCommandConfirmRelease started by the policyAggregateConfirmationRead model · kept up to dateRelease confirmationsSource: application/usecases/release_confirmation.go · adapters/inbound/kafka/release_confirmation_consumer.go · adr/0043-release-confirmation-from-workunitcreated.md
-
Flag a release nobody confirmed
A housekeeping sweep finds released lines still unconfirmed after the timeout and flags each once. It only reports. Nothing is cancelled, re-released or retried. This runs only when switched on.
TimeHousekeeping sweepPolicyEvery sweep, flag each released line still unconfirmed after the timeout, onceRead modelRelease confirmationsCommandFlagUnconfirmed started by the clockReleases AggregateConfirmationEventOrderRelease analytics stream onlyUnconfirmed Source: application/usecases/release_confirmation.go · cmd/order/housekeeping.go · adr/0043-release-confirmation-from-workunitcreated.md
Hot spots and opportunities
Open questions and known gaps, each taken from a decision record or a document in the repository, never invented. Opportunities are improvements the documentation already names.
- Hot spotOnce any line is released the order can no longer be cancelled, and work already released is not clawed back.
- Hot spotRelease is fire-and-forget. Without the opt-in confirmation, this context never learns whether wes-work-planning created the work.
Source: README.md
- Hot spotA line that is never confirmed is only flagged. No automatic reaction exists, and compensation would need its own decision.
Source: docs/adr/0043-release-confirmation-from-workunitcreated.md
- Hot spotA held order has no timeout inside this context. It relies on its caller, or network-fulfillment's sweep, to release or cancel it.
Source: docs/adr/0020-network-originated-demand-hold-and-deadline-feasibility.md
- Hot spotPath capacity and cycle time are per path for the whole fleet, not per site, because upstream contracts carry no site.
Opportunities
- OpportunityPer-site path capacity could be used once wes-work-planning and process-path-management carry a site on their contracts.
- OpportunityA dedicated reply event from wes-work-planning could replace watching WorkUnitCreated to confirm a release.
Source: README.md
This board is a reconstruction from the code and documentation of order-management at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.