Skip to main content

EventStorming

A design-level storm following the EventStorming glossary: orange events, blue commands, lilac policies, yellow aggregates, pink external systems, red hotspots. Chronology runs left to right; the diagram is read as "command, aggregate, event, policy, next command".

Source: internal/domain/departure/events.go, internal/domain/load/events.go, internal/domain/volume/events.go, internal/application/usecases/*.go (policy names in the comments of generate.go, consumers.go).

Timeline in words​

  1. Network is shaped (external): node-topology registers nodes, declares profiles with cutoffs, activates vendor fulfillment centres and opens lanes.
  2. Policy PickupFromCutoffs: every cutoff of a pickup-eligible node gets a PICKUP departure for the horizon, and stale unbooked ones are cancelled when the profile changes.
  3. Planner defines a lane schedule; policy HorizonRoll turns its slots into LINEHAUL or AIR departures every GENERATE_INTERVAL. DepartureScheduled is the first event other contexts see.
  4. Order-sourcing locks an assignment; policy BookOnLock books one package, or moves the booking, or fails it.
  5. A departure may be cancelled by the planner or by a node leaving service: its bookings are rebooked.
  6. Operators build the load: open, add packages, close (the departure closes with it), dispatch (departure leaves), receive (departure arrives).

Hotspots​

HotspotState
BookingFailed leaves the assignment FAILED in this context (ADR 0002 A14). order-sourcing records it as processed and changes no state (its handler: the departure's own cancellation or capacity events drive re-optimisation); delivery-promise flags the assignment's promise AT_RISK and skips that departure when re-promising (RepromiseOnRisk)open for the booking itself; the promise side is handled
FulfillmentCancelled only updates the expected volume (ADR 0002 A16): it never releases the package booked on a departureaccepted assumption
A LabelVoided removes the tracking number but keeps the booking (A18)accepted assumption
Outbox backlog, consumer lag and dead letters are not meteredopen, see Observability
A row past OUTBOX_MAX_ATTEMPTS lets later events of the same aggregate overtake itaccepted, see Runbook