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.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

events published
12
commands
12
policies
19
read models
6
hot spots
5

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
  1. 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 classification
    CommandApplyProductClassificationstarted by the policy
    Read model · kept up to dateProduct classification copy

    Source: application/usecases/product_classification.go · adapters/inbound/kafka/product_classification_consumer.go

  2. 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 copy
    CommandApplyCPTScheduleChangedstarted by the policy
    Read model · kept up to dateProcess paths and cutoffs

    Source: adapters/outbound/kafkacatalog/consumer.go · adapters/outbound/kafkacptschedule/consumer.go

  3. 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
    EventPathCapacityChanged
    PolicyWhenever a path's remaining capacity changes, update the local copy
    CommandApplyPathCapacityChangedstarted by the policy
    Read model · kept up to dateRemaining path capacity

    Source: adapters/outbound/kafkapathcapacity/consumer.go

  4. 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
    EventCapacityPlanPublished
    PolicyWhenever a capacity plan or shortage is published, store its window; a draft never overwrites a published one
    CommandApplyPlannedCapacitystarted by the policy
    Read model · kept up to datePlanned capacity windows

    Source: application/usecases/planned_capacity.go · adapters/inbound/kafka/planned_capacity_consumer.go

  5. 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 channel
    Read modelProduct classification copy
    Read modelProcess paths and cutoffs
    Read modelRemaining path capacity
    CommandReceiveOrderPOST /orders
    AggregateOrder
    EventOrderReceivedanalytics stream only
    EventOrderLineAllocatedanalytics stream only
    EventOrderAllocated
    EventOrderLineReleasedanalytics stream only
    EventOrderReleasedanalytics stream only
    Systemwes-work-planning
    PolicyTurns each released line into a work unit on its process path
    Systemreturns-processing
    PolicyKeeps a copy of the allocated lines for later return checks
    Systemwarehouse-planning
    PolicyAdds the order to its expected demand

    Source: application/usecases/receive_order.go · application/usecases/allocation.go · application/usecases/allocation_events.go · domain/order/order.go

  6. 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 channel
    Read modelProduct classification copy
    Read modelProcess paths and cutoffs
    Read modelRemaining path capacity
    CommandReceiveOrderPOST /orders
    AggregateOrder
    EventOrderReceivedanalytics stream only
    EventOrderLineAllocatedanalytics stream only
    EventOrderLineBackorderedanalytics stream only
    EventOrderPartiallyAllocated
    EventOrderAllocationPartiallyFailedanalytics stream only
    Systemwes-work-planning
    PolicyCreates work only for the lines that were released

    Source: application/usecases/receive_order.go · application/usecases/allocation.go · adr/0003-ship-complete-default-and-fail-closed-allocation.md

  7. 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.

    ActorOperator
    CommandRetryAllocationPOST /orders/{id}/allocation-retries
    AggregateOrder
    EventOrderLineAllocatedanalytics stream only
    EventOrderLineBackorderedanalytics stream only
    EventOrderAllocated
    EventOrderPartiallyAllocated
    EventOrderLineReleasedanalytics stream only
    EventOrderReleasedanalytics stream only
    EventOrderAllocationPartiallyFailedanalytics stream only
    Systemwes-work-planning
    PolicyTurns each newly released line into a work unit

    Source: application/usecases/retry_allocation.go · application/usecases/allocation.go

  8. 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 caller
    Read modelProcess paths and cutoffs
    Read modelRemaining path capacity
    CommandReceiveOrderPOST /orders
    AggregateOrder
    EventOrderReceivedanalytics stream only
    EventOrderLineAllocatedanalytics stream only
    EventOrderAllocated
    EventSiteSkuDemandChanged
    Systemnetwork-inventory-planning
    PolicyKeeps the line's demand at its site in a local copy

    Source: 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

  9. 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 caller
    Read modelOrder view with promise date
    CommandReleaseHeldOrderPOST /orders/{id}/releases
    AggregateOrder
    EventOrderLineBackorderedanalytics stream only
    EventOrderAllocated
    EventOrderPartiallyAllocated
    EventOrderLineReleasedanalytics stream only
    EventOrderReleasedanalytics stream only
    Systemwes-work-planning
    PolicyTurns each released line into a work unit on its process path

    Source: application/usecases/release_held_order.go · application/usecases/allocation.go · adr/0020-network-originated-demand-hold-and-deadline-feasibility.md

  10. 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 channel
    CommandCancelOrderDELETE /orders/{id}
    AggregateOrder
    EventOrderCancelledanalytics stream only
    EventSiteSkuDemandChanged
    Systemnetwork-inventory-planning
    PolicyDrops the cancelled lines from its demand copy, for orders with a site
    Systemslotting-optimization
    PolicyDrops the cancelled lines from its demand copy, for orders with a site

    Source: application/usecases/cancel_order.go · domain/order/order.go · adr/0004-cancellation-boundary-at-release.md

  11. 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 again
    Read modelProcess paths and cutoffs
    Read modelRemaining path capacity
    CommandRepromiseOrderstarted by the policy
    AggregateOrder
    EventOrderRepromised
    EventSiteSkuDemandChanged
    Systemexception-management
    PolicyCloses the open exceptions it matches to this order

    Source: application/usecases/repromise_order.go · adapters/inbound/kafka/repromise_consumer.go · adr/0018-repromise-order-consumer-and-order-repromised.md

  12. 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
    EventPackageMissedLoad
    PolicyWhenever a package misses its load, work out the promise of every group of its order again
    Read modelProcess paths and cutoffs
    Read modelRemaining path capacity
    CommandRepromiseOrderstarted by the policy
    AggregateOrder
    EventOrderRepromised

    Source: application/usecases/repromise_order_missed_load.go · adapters/inbound/kafka/outbound_shipping_consumer.go · adr/0051-consume-shipment-confirmed-and-package-missedload.md

  13. 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 shipped
    CommandConfirmShipmentstarted by the policy
    AggregateOrder

    Source: application/usecases/confirm_shipment.go · adapters/inbound/kafka/outbound_shipping_consumer.go · adr/0051-consume-shipment-confirmed-and-package-missedload.md

  14. 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
    EventWorkUnitCreated
    PolicyWhenever a work unit is created for a released line, mark that line's release confirmed
    CommandConfirmReleasestarted by the policy
    AggregateConfirmation
    Read model · kept up to dateRelease confirmations

    Source: application/usecases/release_confirmation.go · adapters/inbound/kafka/release_confirmation_consumer.go · adr/0043-release-confirmation-from-workunitcreated.md

  15. 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 sweep
    PolicyEvery sweep, flag each released line still unconfirmed after the timeout, once
    Read modelRelease confirmations
    CommandFlagUnconfirmedReleasesstarted by the clock
    AggregateConfirmation
    EventOrderReleaseUnconfirmedanalytics stream only

    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.

Opportunities

  • OpportunityPer-site path capacity could be used once wes-work-planning and process-path-management carry a site on their contracts.

    Source: .claude/rules/deferred-and-known-gaps.md

  • 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.