Warehouse execution (WES) · Supporting domain · EventStorming board

network-fulfillment

The seam to the external retail network: answers its purchase orders in time, tells it what the building can ship, and reports what the dock received.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

events published
7
commands
15
policies
26
read models
13
hot spots
5

The story in 4 key events

The pivotal events: the few that matter most, in the order they happen.

  1. Pivotal eventNetworkOrderReceived
  2. Pivotal eventNetworkOrderSubmitted
  3. Pivotal eventNetworkOrderAcknowledged
  4. Pivotal eventNetworkOrderShipmentConfirmed

Listens to (4): contexts whose events this one reacts to

Tells (1): contexts that react to its events

The board, row by row

17 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. Take a purchase order and hold the stock

    A new purchase order is recorded and its products are translated to our SKUs. order-management holds the stock and promises a ship date. If the date is feasible, the whole order is accepted.

    System · outsideRetail network
    EventPurchase order issued
    PolicyWhenever a poll finds a new purchase order, record it and start its answer clock
    Read modelProduct dictionary
    Read modelShip-by promise from order-management
    CommandReceiveNetworkDemanda background job
    AggregateNetworkOrder
    EventNetworkOrderReceived
    EventNetworkOrderSubmitted
    System · outsideRetail network
    PolicyIs told the whole order is accepted; it is settled later

    Source: application/usecases/receive_network_demand.go · adapters/inbound/poller/poller.go · adapters/outbound/ordermanagement/planner.go · domain/networkorder/network_order.go

  2. Refuse an order we cannot take

    One unknown product, or a ship-by date the building cannot meet, refuses the whole order. Any stock already held is freed and the network is told no, with the reason.

    System · outsideRetail network
    EventPurchase order issued
    PolicyWhenever a purchase order has an unknown product or an infeasible date, refuse all of it
    Read modelProduct dictionary
    Read modelShip-by promise from order-management
    CommandReceiveNetworkDemanda background job
    AggregateNetworkOrder
    EventNetworkOrderReceived
    EventNetworkOrderRejected
    System · outsideRetail network
    PolicyIs told no, with the reason (unknown listing or cannot meet ship-by)

    Source: application/usecases/receive_network_demand.go · adapters/outbound/producttranslation/dictionary.go · domain/networkorder/network_order.go

  3. Settle an accepted order

    The network confirms or refuses an answer later. On success the order is acknowledged and the held stock is released. On failure the hold is freed and the order is refused.

    TimeSettle pass
    PolicyEvery pass, ask the network about each accepted order: success settles it, failure refuses it, pending waits
    Read modelOrders awaiting settlement
    Read modelNetwork's status for each answer
    CommandReconcileSubmittedOrdersstarted by the clock
    AggregateNetworkOrder
    EventNetworkOrderAcknowledged
    EventNetworkOrderRejected

    Source: application/usecases/reconcile_submitted_orders.go · domain/networkorder/network_order.go · 0016-cloudevents-submitted-and-settle-time-acknowledged.md

  4. Confirm orders when the load ships

    outbound-shipping announces that a load shipped. Each network order on it is confirmed the way an operator would, so a repeat confirms nothing twice. An order still waiting for the network's answer is noted and confirmed later; one we do not hold is skipped.

    Systemoutbound-shipping
    EventShipmentConfirmed
    PolicyWhenever a load is confirmed as shipped, confirm the network orders on it
    Read modelAcknowledged orders
    CommandConfirmNetworkOrderShipmentstarted by the policy
    AggregateNetworkOrder
    EventNetworkOrderShipmentConfirmed
    System · outsideRetail network
    PolicyIs sent the label request and then the shipment confirmation

    Source: adapters/inbound/kafka/shipment_confirmed_consumer.go · application/usecases/confirm_network_order_shipment.go · 0014-explicit-shipment-confirmation-endpoint.md

  5. Confirm a shipment noted before the answer

    A load can leave while its order still waits for the network's answer, so the order notes the shipment. A timer later confirms it once the order is acknowledged, or drops it if the order was refused or is already confirmed.

    TimeNoted-shipment timer
    PolicyEvery pass, confirm a noted shipment once its order is acknowledged, and drop it if the order needs no confirmation
    Read modelOrders with a noted shipment
    CommandConfirmPendingShipmentsstarted by the clock
    AggregateNetworkOrder
    EventNetworkOrderShipmentConfirmed
    System · outsideRetail network
    PolicyIs sent the label request and then the shipment confirmation

    Source: application/usecases/confirm_pending_shipments.go · application/usecases/defer_shipment_confirmation.go · domain/networkorder/pending_shipment.go · 0014-explicit-shipment-confirmation-endpoint.md

  6. Confirm that an order shipped, by hand

    An operator can confirm an acknowledged order as shipped without waiting for the event. The network gets a label request first. This route is kept as the fallback.

    ActorOperator
    Read modelAcknowledged orders
    CommandConfirmNetworkOrderShipmentPOST /network-orders/{networkRef}/shipment-confirmation
    AggregateNetworkOrder
    EventNetworkOrderShipmentConfirmed
    System · outsideRetail network
    PolicyIs sent the label request and then the shipment confirmation

    Source: application/usecases/confirm_network_order_shipment.go · adapters/inbound/kafka/shipment_confirmed_consumer.go · 0014-explicit-shipment-confirmation-endpoint.md

  7. Report an order past its answer deadline

    A sweep finds orders still unanswered after their deadline and reports each one on every pass. It never changes the order itself.

    TimeDeadline sweep
    PolicyEvery sweep, report each unanswered order that is past its deadline, and leave the order unchanged
    Read modelUnanswered orders
    CommandSweepAcknowledgementDeadlinesstarted by the clock
    AggregateNetworkOrder
    EventAcknowledgementDeadlineAtRisk
    Systemexception-management
    PolicyOpens an exception for the order, or adds to the one already open

    Source: application/usecases/sweep_acknowledgement_deadlines.go · domain/networkorder/network_order.go

  8. Refuse an order nobody answered in time

    A separate sweep refuses orders whose deadline passed unanswered, and frees the held stock if there is a hold. An overdue order is never answered late.

    TimeOverdue sweep
    PolicyEvery sweep, refuse each unanswered order that is past its deadline and free its held stock
    Read modelUnanswered orders
    CommandRejectOverdueOrdersstarted by the clock
    AggregateNetworkOrder
    EventNetworkOrderRejected

    Source: application/usecases/reject_overdue_orders.go · domain/networkorder/network_order.go

  9. Free a hold nobody decided

    order-management never times out a held order, so this context does. An open hold well past the deadline is cancelled and reported. The order's own state is left alone.

    TimeOrphaned-hold sweep
    PolicyEvery sweep, cancel any open hold that is past its deadline plus a grace period
    Read modelOpen holds
    CommandSweepOrphanedHoldsstarted by the clock
    AggregateNetworkOrder
    EventOrphanedHoldCancelled
    Systemexception-management
    PolicyOpens an exception for the order, or adds to the one already open

    Source: application/usecases/sweep_orphaned_holds.go · domain/networkorder/hold.go · 0024-orphaned-order-management-hold-sweep.md

  10. Keep the cutoff schedule copy

    process-path-management announces process paths and their cutoff schedules. A local copy of the cutoffs and path cycle times lets offers and the site profile be worked out without a live call.

    Systemprocess-path-management
    EventCPTScheduleChanged
    PolicyWhenever a path or its cutoff schedule changes, update the local copy
    CommandApplySchedulestarted by the policy
    Read model · kept up to dateCutoff schedule and path times

    Source: adapters/outbound/processpathcache/consumer.go · adapters/outbound/processpathcache/schedule.go

  11. Keep the path capacity copy

    wes-work-planning announces how much capacity is left on each path before each cutoff. A local copy lets offers and cutoff ceilings be worked out without a live call.

    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 capacity per path

    Source: adapters/outbound/pathcapacitycache/consumer.go

  12. Work out what we could offer

    For each known SKU the offer is the lower of the stock usable now and what the paths can still handle before the next feasible cutoff. Unknown capacity falls back to stock.

    TimeRecompute pass
    PolicyEvery pass, work out an offer per SKU from usable stock and the capacity before the next cutoff
    Read modelProduct dictionary
    Read modelCutoff schedule and path times
    Read modelRemaining capacity per path
    CommandRecomputeCapabilityOffersstarted by the clock
    AggregateCapabilityOffer
    Read model · kept up to dateCapability offers

    Source: application/usecases/recompute_capability_offers.go · domain/capabilityoffer/capability_offer.go · 0031-advertise-against-the-next-feasible-cutoff.md

  13. Tell the network how the building works

    In live mode, each site's cutoffs, handling time and order ceilings are derived from the local copies and declared to the network. A new revision is sent only when the content changed.

    TimeProfile pass
    PolicyEvery pass, declare each site's operating profile to the network, but only if it changed
    Read modelCutoff schedule and path times
    Read modelRemaining capacity per path
    CommandDeclareNodeProfilesstarted by the clock
    System · outsideRetail network
    PolicyLearns each site's cutoffs, handling time and order ceilings

    Source: application/usecases/declare_node_profiles.go · application/usecases/profile_derivation.go · 0027-supply-loop-node-profile-and-inventory-feed.md

  14. Tell the network what we can ship

    In live mode, the saved offers become an inventory feed per site. The feed is sent when it changed, and repeated at most hourly when it did not.

    TimeInventory feed pass
    PolicyEvery pass, send each site's offers for the items the site lists, when they changed
    Read modelCapability offers
    Read modelProduct dictionary
    CommandFeedInventorystarted by the clock
    System · outsideRetail network
    PolicyLearns how many of each listed item the site can ship

    Source: application/usecases/feed_inventory.go · application/usecases/feed_plan.go · 0027-supply-loop-node-profile-and-inventory-feed.md

  15. Announce a seller shipment to receiving

    In live mode, shipments the network says are on their way are recorded. Each one is registered in inbound-receiving as an expected delivery before the truck arrives. Failures are retried with a growing wait.

    System · outsideRetail network
    EventSeller shipment announced
    PolicyWhenever a poll finds a shipped seller shipment, record it and register an expected delivery
    Read modelProduct codes (GTIN to SKU)
    CommandIntakeInboundShipmentsa background job

    Source: application/usecases/intake_inbound_shipments.go · adapters/outbound/inboundreceiving/client.go · 0028-inbound-loop-seller-shipments-and-receipts.md

  16. Keep a copy of the receipts at the dock

    inbound-receiving announces each accepted carton, each carton finding and each closed receipt. A local copy keeps only the deliveries this context announced, so the result can be reported later.

    Systeminbound-receiving
    EventReceiptClosed
    PolicyWhenever a receipt closes, keep it with its cartons and findings, but only for our own deliveries
    CommandRecordClosedstarted by the policy
    Read model · kept up to dateReceipt facts for our deliveries

    Source: adapters/inbound/kafka/receipt_consumer.go · adapters/outbound/postgres/receipt_projection_repo.go · 0028-inbound-loop-seller-shipments-and-receipts.md

  17. Report what the dock received

    Each closed receipt is turned into a per-carton result: received, damaged, missing or unexpected, with any findings. It is sent to the network exactly once per shipment.

    TimeReceipt return pass
    PolicyEvery pass, report each closed receipt not yet reported, retrying with a growing wait
    Read modelReceipt facts for our deliveries
    CommandReturnInboundReceiptsstarted by the clock
    System · outsideRetail network
    PolicyIs told what arrived, carton by carton, with the findings

    Source: application/usecases/return_inbound_receipts.go · 0028-inbound-loop-seller-shipments-and-receipts.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

This board is a reconstruction from the code and documentation of network-fulfillment at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.