Event Storm — Order Fulfilment
Retail order fulfilment across ordering, warehouse and delivery contexts, with two cross-context policies and an uncommanded delivery event the storm leaves on the wall.
Make it your own.
title "Order fulfilment — big picture storm"
context "Ordering"
actor Customer
aggregate Order
# `emits` is the mirror of the event's `from` — either dialect links the pair.
command "Place order" by Customer on Order emits "Order placed"
event "Order placed"
readmodel "Order confirmation"
command "Apply promotion code" by Customer on Order
event "Promotion applied" from "Apply promotion code"
external "Stripe payments"
hotspot "Who owns the basket once payment has started?"
policy "When order placed, reserve stock" then "Reserve stock"
context "Warehouse"
aggregate Reservation
command "Reserve stock" by "Fulfilment service" on Reservation
event "Stock reserved" from "Reserve stock"
policy "When stock reserved, pick and pack" then "Pick and pack"
command "Pick and pack" by "Warehouse operative" on Reservation
event "Parcel packed" from "Pick and pack"
hotspot "A reserved SKU is damaged in the aisle"
policy "When parcel packed, book courier" then "Book courier"
context "Delivery"
aggregate Shipment
command "Book courier" by "Despatch service" on Shipment
event "Courier booked" from "Book courier"
readmodel "Where is my order"
event "Parcel delivered" on Shipment
external "Carrier tracking API"
hotspot "Failed delivery — refund or redeliver?"