Skip to main content

EventStorming

Process-level boards in the ddd-crew EventStorming glossary and cheat sheet notation. Every sticky comes from the code of this repository; the hotspots are the gaps or risks that remain in what is built, and the inventory at the end says where each one comes from. The domain-wide board is EventStorming big picture.

Legend​

ColourStickyMeaning
Blue #a5d8ffCommandAn intent this context handles
Yellow #ffec99AggregateShippingLabel or PackageJourney
Orange #ffc078Domain eventA fact, this context's or a neighbour's
Lilac #d0bfffPolicy"Whenever X, then Y"
Green #b2f2bbRead modelData a decision reads
Pink #fcc2d7External systemA neighbour context or actor
Red #ff8787HotspotA gap or risk

1. Label issue​

Source: internal/application/usecases/labels.go (IssueLabel.execute, create), internal/domain/label/label.go, internal/domain/journey/journey.go (Start). The label, its sealed snapshot, the journey and the outbox row are one transaction. Omitted: the duplicate-label and ship-to-unavailable branches (see Use cases) and the outbox relay.

1b. Label void​

Source: internal/application/usecases/labels.go (VoidLabel.Execute), internal/domain/journey/journey.go (Void). The journey closes as VOIDED in the same transaction and raises no event of its own; a handed-over package is ErrVoidAfterHandover.

2. Timeline consolidation​

2a. Handover and the middle mile​

Source: internal/adapters/inbound/kafka/handlers.go (VendorHandlers, LinehaulHandlers), internal/application/usecases/scans.go (ApplyScans), internal/domain/journey/journey.go (apply). Omitted: the REST route POST /journeys/{trackingNumber}/scans (same use case, caller not named); duplicate and out-of-order scans (stored or refused, no event).

2b. Last mile​

Source: internal/adapters/inbound/kafka/handlers.go (LastMileHandlers). A failed attempt returns the journey to AT_STATION and raises PackageScanned only.

2c. Day-of ETA window and delivery-point flag​

Source: internal/adapters/inbound/kafka/handlers_lastmile.go (etaHandler, flagHandler), internal/application/usecases/eta.go (ApplyEtaWindows), internal/application/usecases/point_flag.go (RelayDeliveryPointFlag), internal/domain/journey/journey_eta.go, internal/domain/journey/journey_point_flag.go (ADR 0013, ADR 0014). Neither is a scan: the journey state does not change, and each raises one event per package of the stop. A stale window or flag, a closed journey and an unknown tracking number are counted and acknowledged without an event.

3. Exceptions and terminal outcomes​

Source: internal/application/usecases/sweep.go (SweepSilence, decide), internal/application/usecases/scans.go (ReturnToSender), internal/domain/journey/types.go. Omitted: ErrJourneyClosed on a closed journey.

Sticky inventory​

StickyKindSource
IssueLabel, VoidLabelCommandusecases/labels.go
Start journey, RecordScan, RaiseException, ReturnToSender, DeclareLostCommandjourney/journey.go, usecases/scans.go, usecases/sweep.go
ApplyEtaWindows (AssignEta), RelayDeliveryPointFlag (FlagDeliveryPoint)Commandusecases/eta.go, usecases/point_flag.go
ShippingLabel, PackageJourneyAggregatedomain/label, domain/journey
LabelIssued, LabelVoided, PackageScanned, PackageHandedOver, PackageDelivered, PackageExceptionRaised, PackageReturned, PackageLost, PackageEtaWindowAssigned, PackageDeliveryPointFlaggedDomain event (own)label/events.go, journey/events.go
VendorShipmentConfirmed, LoadDeparted, LoadArrived, PackageOutForDelivery, DeliveryAttempted, PackageReturnInitiated, StopEtaWindowAssigned, DeliveryPointFlaggedDomain event (neighbour)inbound/kafka/handlers.go, inbound/kafka/handlers_lastmile.go
Handover on first pickup departure, exception on silence, lost after 48 hours, a stop event reaches every package of the stopPolicyjourney.apply, journey.SilenceWindow, Journey.Lost, etaHandler, flagHandler
catalog_dimensionsRead modelports.CatalogDimensionsView
vendor-connectivity, customer-ordering, linehaul-transportation, last-mile-delivery, delivery-promise, order-sourcing, node-performanceExternal systemapis/asyncapi.yaml, outbound/customerordering

Not drawn on any board: the carrier handoff (PackageHandedToCarrier, ADR 0015), the pickup collection (PackageReadyForCollection, PackageCollected, ADR 0016) and the consumed ServiceAreaAssigned and node lifecycle events (NodeRegistered, NodeActivated, NodeSuspended, NodeRetired). They are in Domain events.

Hotspots and where they come from​

HotspotBoardSource
Printable label not rendered1No route of apis/openapi.yaml returns anything printable; the response is the label metadata
VoidLabel and RecordScan have no named caller1b, 2aThe routes are unauthenticated and the contracts name no caller
A load or route event for an unknown tracking number2aApplyScans counts it as unknown and acknowledges it (internal/application/usecases/scans.go)
Sweep race with a late scan3SweepSilence counts ErrConcurrentUpdate as a conflict and sees the journey again on the next tick