Skip to main content

EventStorming

Process-level EventStorming in the ddd-crew EventStorming glossary & cheat sheet notation. Every sticky comes from the yard design model. Hotspots were the genuine open questions or risks in the design model when this page was written; the source of each is in the hotspot table, whose last column says how the built service settled it. The boards keep the hotspot stickies as they were drawn.

Legend​

ColourStickyHex
BlueCommand#a5d8ff
YellowAggregate#ffec99
OrangeDomain Event#ffc078
LilacPolicy#d0bfff
GreenRead Model#b2f2bb
PinkExternal System (a sibling context or an actor)#fcc2d7
RedHotspot#ff8787

1. Booking, rescheduling and cancelling​

Source: internal/domain/dockappointment/appointment.go, internal/domain/dockappointment/commands.go, internal/domain/dockappointment/events.go, internal/adapters/inbound/kafka/yard_consumer.go, internal/adapters/inbound/kafka/facility_consumer.go, internal/adapters/inbound/kafka/asn_consumer.go, internal/adapters/inbound/kafka/cutoff_consumer.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml, internal/application/ports/ports.go, migrations/0001_dock_scheduling.up.sql.

Omitted: the refusals (ErrInvalidDoorCode, ErrInvalidCarrier, ErrInvalidWindow, ErrWindowInPast, ErrUnknownDoor, ErrDoorFlowMismatch, ErrDoorDoubleBooked, ErrDoorUnavailable, ErrUnknownAsn, ErrMissingOutboundRef). The consumer nodes follow the neighbours' own consumer code: inbound-receiving reads DockAppointmentBooked, DockAppointmentRescheduled and DockAppointmentCancelled; outbound-shipping reads DockAppointmentBooked only.

2. Arrival at the gate and a different door​

Source: internal/domain/dockappointment/appointment.go, internal/domain/dockappointment/commands.go, internal/domain/dockappointment/events.go, internal/application/usecases/facts.go, internal/application/usecases/yard.go, internal/application/usecases/change.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml.

Omitted: DockAppointmentCheckedIn and AtRisk are analytics only; no context reacts to them. DoorReassigned is also on the integration topic since service ADR 0010 (inbound-receiving reads it). E5 is raised for the overlapped appointment, with cause DOOR_REASSIGNED_OVERLAP.

3. Door release and out-of-order yard facts​

Source: internal/domain/dockappointment/appointment.go, internal/domain/dockappointment/commands.go, internal/domain/dockappointment/events.go, internal/application/usecases/facts.go, internal/application/usecases/yard.go, internal/application/usecases/change.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml.

Omitted: DockAppointmentCompleted is analytics only. OutOfOrderYardFacts is drawn into RecordDoorRelease because it defines the BOOKED to COMPLETED path; it also says a late VisitCheckedIn for a COMPLETED appointment is ignored and that any yard fact for a CANCELLED or NO_SHOW appointment is ignored and counted.

4. ETA risk and no-show​

Source: internal/domain/dockappointment/appointment.go, internal/domain/dockappointment/commands.go, internal/domain/dockappointment/events.go, internal/application/usecases/facts.go, internal/application/usecases/yard.go, internal/application/usecases/change.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml.

Omitted: DockAppointmentNoShow also triggers NoShowFreesHolding in yard-management, drawn in Domain Message Flow.

5. ASN cancellation​

Source: internal/application/usecases/facts.go, internal/application/usecases/yard.go, internal/application/usecases/change.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml, internal/application/ports/ports.go, migrations/0001_dock_scheduling.up.sql.

Omitted: only an INBOUND BOOKED appointment whose ASNs are all cancelled is cancelled by the policy; the reason is ASN_CANCELLED.

6. The door calendar​

Source: internal/domain/dockcalendar/calendar.go, internal/domain/dockcalendar/events.go, internal/adapters/inbound/kafka/yard_consumer.go, internal/adapters/inbound/kafka/facility_consumer.go, internal/adapters/inbound/kafka/asn_consumer.go, internal/adapters/inbound/kafka/cutoff_consumer.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml, internal/application/ports/ports.go, migrations/0001_dock_scheduling.up.sql.

Omitted: ErrInvalidOperatingHours, ErrOverlappingClosure and ErrClosureConflictsWithAppointments refusals. DeclareCalendarSettings raises no event; DoorOperatingHoursDeclared is analytics only.

7. Phase-2 pickups​

Source: internal/application/usecases/facts.go, internal/application/usecases/yard.go, internal/application/usecases/change.go, internal/adapters/inbound/kafka/yard_consumer.go, internal/adapters/inbound/kafka/facility_consumer.go, internal/adapters/inbound/kafka/asn_consumer.go, internal/adapters/inbound/kafka/cutoff_consumer.go, internal/application/ports/ports.go, migrations/0001_dock_scheduling.up.sql.

Omitted: the dotted arrow from PickupFromCutoffs is the policy keeping one OUTBOUND appointment per cutoff and operating day; the design model names no command for it, and in the code it does not exist: the schedule is stored and no appointment is created from it. The strangler import that this board once showed was removed (ADR 0011).

Hotspots​

#HotspotWhere it comes from in the design modelGapIn the code (2026-11-09)
H1CancellationReason has SITE_REQUEST, but the only inbound row for cancel is the carrier scheduler.aggregates[DockAppointment], reasons[CancellationReason], inbound[0]DS-G10Settled (D-5): the dock planner cancels with CARRIER_REQUEST or SITE_REQUEST through the same route.
H2DockAppointmentRescheduled carries door_code but no previous door; the design model does not say a reschedule may change the door.publishes[DockAppointmentRescheduled].dataDS-G06Settled (D-4, X1): a reschedule may change the door; the event carries previous_door_code.
H3An appointment is one carrier visit, but VisitCheckedIn carries trailers, and the first TrailerUndocked completes the appointment.policies[CompleteOnDoorRelease], contexts[yard-management].publishes[VisitCheckedIn]DS-G03Settled (X3): one appointment covers exactly one trailer.
H4The arrival tolerance is a DockCalendar setting; yard-management's DirectOnCheckIn needs it and no event carries it.aggregates[DockCalendar].value_objects, contexts[yard-management].policies[DirectOnCheckIn]DS-G01Settled (X1): Booked and Rescheduled carry arrival_tolerance_minutes.
H5The out-of-order rules cover four cases; a second VisitCheckedIn, a TrailerDocked after completion and an implicit arrival in the adherence report are not covered.policies[OutOfOrderYardFacts, ArrivalFromGate]DS-G19Settled: the state machine decides; an already applied or terminal fact is ignored and counted, an implicit arrival is counted as ON_TIME (X6).
H6DockAppointmentAtRisk is analytics only and no read model or route exposes it, yet the console and the ops agent are meant to show at-risk appointments.publishes[DockAppointmentAtRisk], fleet_changesDS-G11Settled (D-6): the REST appointment exposes atRisk and atRiskCause, GET /appointments filters on atRisk and the MCP tool list_at_risk_appointments lists them.
H7NO_SHOW has no outgoing transition; a carrier that arrives after the sweep is ignored by this context.aggregates[DockAppointment].transitions, policies[OutOfOrderYardFacts]DS-G16Settled (D-9): terminal, a late carrier books anew.
H8TURNED_AWAY has no producer, and VisitRejected is not consumed here.reasons[CancellationReason], consumes, contexts[yard-management].publishes[VisitRejected]DS-G02Settled (X2): VisitRejected is consumed (policy CancelOnVisitRejected), TURNED_AWAY is its cancellation reason.
H9A closure is refused if it covers an active appointment; a change of operating hours and a decommissioned door are not.aggregates[DockCalendar].invariants, consumes[facility-layout]DS-G12, DS-G13Settled: new hours that strand an appointment are refused (D-8); a decommissioned door blocks new bookings only (D-7).
H10DeclareCalendarSettings raises no event, and no default is given for the arrival tolerance or the no-show grace.aggregates[DockCalendar], publishesDS-G07, DS-G01Settled (D-1): defaults 240, 15, 15 and 60 minutes, created lazily; the tolerance travels on the booking events.
H11ImportLegacyAppointment lists no invariants, and the effect of the legacy check-in, cancel and complete events is not stated.policies[LegacyImport], consumes[inbound-receiving]DS-G08Settled (D-2): no invariant is enforced; later legacy events move only legacy-import appointments. Moot since ADR 0011: the importer was removed.
H12PickupFromCutoffs names PickupDoorRule and pickup_lead, defined nowhere, and creates an appointment with no carrier.policies[PickupFromCutoffs], aggregates[DockAppointment].invariantsDS-G04Open by decision (D-3): phase 2. The schedule is consumed and stored; no appointment is created.