Skip to main content

EventStorming

Design-level boards in the ddd-crew EventStorming glossary and cheat sheet notation, drawn from the code on develop. Events of a neighbour are orange stickies prefixed with the producer. Every hotspot is a gap or risk visible in the code or the contracts; the table at the end names its source. The big picture for the whole network is in the aggregator at EventStorming big picture.

Legend​

ColourStickyMeaning here
Pale yellow #fff59dActorThe shopper, through checkout, storefront-bff, the console remote or a test
Blue #a5d8ffCommandA use case or a synchronous call to delivery-promise
Yellow #ffec99AggregateCustomerOrder or Shopper
Orange #ffc078Domain eventOurs, or a neighbour's prefixed with its producer
Lilac #d0bfffPolicyCheckoutPromising, CancelOnUnfulfillable, or the reaction of a handler to an event
Green #b2f2bbRead modelThe tracking view, or the restricted ship-to read
Pink #fcc2d7External systemA sibling context
Red #ff8787HotspotA gap or risk (table at the end)

1. Registration and checkout​

Source: internal/application/usecases/checkout.go, shopper.go, internal/domain/customerorder/place.go, internal/adapters/outbound/deliverypromise/gateway.go.

2. Fulfilment progress and tracking​

PackageEtaWindowAssigned, PackageDeliveryPointFlagged (ADR 0015), PackageReadyForCollection and PackageCollected (ADR 0016) only update the tracking view; they change no CustomerOrder.

Source: internal/adapters/inbound/kafka/handlers.go, internal/application/usecases/consume_promise.go, consume_sourcing.go, consume_tracking.go, consume_eta.go, consume_point_flag.go, consume_pickup.go, internal/domain/customerorder/commands.go.

3. Cancellation​

Source: internal/application/usecases/cancel.go, internal/domain/customerorder/cancel.go, consume_promise.go, consume_sourcing.go.

Reading it​

  • The shopper's cancel is a request: the group stays in CANCELLATION_REQUESTED until order-sourcing answers, and a vendor that ships first wins.
  • Shopper raises no event and GetShipTo is a read, so neither appears as an orange sticky.
  • The synchronous replies and the outbox are omitted from the boards.

Hotspots​

#HotspotSource
H1If delivery-promise is slow or down the checkout answers 503 delivery-promise-unavailable after DELIVERY_PROMISE_TIMEOUT; there is no fallback promise and the caller must retry with the same Idempotency-Key.deliverypromise/gateway.go, http/errors.go
H2A confirm that fails after earlier groups were confirmed triggers compensating CancelPromise calls. One that fails is logged (compensating cancel of a confirmed promise failed; the hold stays at delivery-promise) and written to the compensation_cancels queue; the compensation worker retries it until delivery-promise releases the hold or refuses it as not cancellable, and a row that reaches COMPENSATION_MAX_ATTEMPTS is left for an operator to re-arm. The hold can still outlive the checkout when the enqueue itself fails, when a row reaches the cap, or when the order cannot be stored after every confirm succeeded (nothing is queued then). When the failed confirm's own answer is unknown its group is cancelled too.usecases/checkout.go (compensate, enqueueFailedCancels), outbound/compensation/worker.go, migration 0005_compensation_cancels, ADR 0002 A14 and its addendum
H3Producers key by their own ids, so a delivery or outcome can arrive before FulfillmentShipped; the code stores and replays it, an unknown order is skipped, not retried.consume_tracking.go, ADR 0002 A7
H4ErrCancelAfterLock is advisory: a lock this service has not consumed yet cannot be seen, and order-sourcing's answer decides.customerorder/cancel.go
H5If publishing to a .dlq topic fails, the consumer keeps retrying and the partition is blocked.Runbook
H6Resolved: the apis/asyncapi.yaml description counted the consumed events wrong more than once ("Fifteen events" while listing seventeen, "Eighteen" while listing nineteen, "Twenty" while listing twenty-one). It now says twenty-one, matching the 21 messages of its receive operations and the 21 handlers in kafka/handlers.go.apis/asyncapi.yaml info description, kafka/handlers.go