Skip to main content

EventStorming (process level)

Uses the ddd-crew EventStorming glossary and cheat sheet notation. Every sticky is an element of the code: a command of FulfillmentAssignment, an event in internal/domain/assignment/events.go or a consumed type in internal/adapters/inbound/kafka/handlers.go. Events from other contexts are orange stickies next to the pink system that publishes them. The aggregate sticky is repeated on each board so lines do not cross. Hotspots are gaps or risks; the inventory at the end says which the build resolved.

Legend​

StickyColourMeaning here
Commandblue #a5d8ffA command of FulfillmentAssignment
Aggregateyellow #ffec99FulfillmentAssignment
Domain eventorange #ffc078An event this context publishes, or a neighbour event it consumes
Policylilac #d0bfffA policy or a business rule
Read modelgreen #b2f2bbOne of the five read models
External systempink #fcc2d7A sibling context
Hotspotred #ff8787An open question or risk
Actorwhite #ffffffA person or this context's own timer

1. Intake and the virtual queue​

Source: internal/adapters/inbound/kafka/handlers.go (CustomerOrdering), usecases/queue.go, usecases/search.go, domain/sourcing/sourcing.go, domain/assignment/commands.go (Queue, Reoptimise). Omitted: the 24 events that feed the five read models (Use cases); a re-optimisation that keeps the same candidate, which raises nothing.

2. Release​

Source: usecases/commands.go (ReleaseToNode), usecases/queue.go (releaseNow), domain/assignment/commands.go (Release). Omitted: ErrReleaseInFlight (a second release while one is pending), shown on Sequence diagrams.

3. The node's answer: lock or refusal​

Source: usecases/commands.go (LockAssignment, HandleNodeRefusal), domain/assignment/commands.go (Lock, RefuseRelease, pendingRelease). The releaseNo of the outcome must be the pending release; an older outcome is logged and ignored. node-performance also reads the three purchase-order events for the scorecard. BookingMoved repoints the pickup departure of a locked assignment (MovePickup) without an event.

4. Re-promise and cancellation​

Source: usecases/cancel_revise.go, domain/assignment/commands.go (ApplyRevisedPromise, Cancel, RefuseCancel).

5. Shipment and delivery​

Source: usecases/commands.go (MarkShipped, MarkDelivered), domain/assignment/commands.go.

Hotspot inventory​

Resolved by the build (the aggregator's earlier boards listed them as open):

HotspotResolution in the code
No releaseAt when no candidate is leftA group with no candidate is UNSOURCEABLE at once, in Queue, Reoptimise, Release and RefuseRelease (ReasonNoCandidate, ReasonNodeRefused)
ApplyRevisedPromise raises no eventIt always raises FulfillmentConstraintRevised
UNSOURCEABLE cannot be cancelledCancel allows QUEUED, RELEASED and UNSOURCEABLE
Exclusion per promise revision without revisionNoPromiseConstraint.RevisionNo; a higher revision resets the list
Multi-package deliveryThe group delivers when the last package does; each PackageDelivered is remembered
Revision of an assignment that is not UNSOURCEABLEApplied in every non-terminal state; the node is only re-searched in QUEUED and UNSOURCEABLE
Destination not on the aggregatedestinationPostalPrefix is on the aggregate and in the table
Promise-book hold stays on the witness nodedelivery-promise moves the capacity charge when FulfillmentLocked names another node or pickup departure (rehomeOnLock, internal/application/usecases/rehome.go in that repository). It keeps the charge on the quoted node, logged and not retried, if the locked departure is unknown, the locked node's book is full or closed, or no single owner there covers the lines

Still open:

HotspotWhere it comes from
Cross-region as penalty versus ruleBusiness decision 5 reads as a filter; CrossRegionPenalty is 1000 points
Acceptance after cancellationA PurchaseOrderAccepted for a CANCELLED assignment is ErrIllegalTransition and only logged; the vendor may still ship
Pickup departure cancelled after the lockDepartureCancelled updates the read model; no transition handles a locked assignment whose departure is gone