Warehouse management (WMS) · Supporting domain · EventStorming board
outbound-shipping
Turns manifested packages into loads for a carrier cutoff, tracks them onto the truck, and confirms the shipment when the truck leaves.
- events published
- 13
- commands
- 16
- policies
- 15
- read models
- 4
- hot spots
- 5
The story in 4 key events
The pivotal events: the few that matter most, in the order they happen.
- Pivotal eventLoad
Planned - Pivotal eventLoad
Closed - Pivotal eventShipment
Confirmed - Pivotal eventBill
Of Lading Issued
Listens to (5): contexts whose events this one reacts to
Tells (3): contexts that react to its events
The board, row by row
16 rows, in the order the business story happens: the main path first, then how this context reacts to the others, then the clock. Rows are small stories; read each one left to right.
- Event
- Command
- Actor
- Aggregate
- Policy
- Read model
- External system
- Hot spot
- Opportunity
-
Keep the cutoff times
process-path-management announces each site's daily cutoffs. Shipping keeps the latest schedule as a local copy, so it can tell which cutoff a package belongs to.
Systemprocess-path- management EventCPTScheduleChanged PolicyWhenever a site's cutoff schedule changes, replace the local copy for that siteCommandApplyCpt started by the policySchedule Read model · kept up to dateCutoff scheduleSource: application/usecases/apply_cpt_schedule.go · adapters/inbound/kafka/cpt_layout_consumers.go
-
Plan a load for a manifested package
A packed parcel is manifested. Shipping works out which cutoff it must make, joins the open load for that cutoff or plans a new one, and expects the package on it.
Systemfulfillment-execution EventPackageManifested PolicyWhenever a package is manifested, join the open load for its cutoff or plan oneRead modelCutoff scheduleCommandExpectPackage started by the policyAggregateOutboundLoad EventLoadPlanned Source: application/usecases/expect_package.go · domain/outboundload/commands.go · adapters/inbound/kafka/fulfillment_consumer.go
-
Drop a diverted package
If fulfillment diverts a package, it is short-shipped at once with the reason DIVERTED, so it cannot hold up the closing of its load.
Systemfulfillment-execution EventPackageDiverted PolicyWhenever a package is diverted, short-ship it so its load can still closeCommandDivertPackage started by the policyAggregateShippingPackage Source: application/usecases/divert_package.go · domain/shippingpackage/commands.go
-
Give the load a door
dock-scheduling books an outbound appointment for a cutoff. The appointment is always kept, and its door goes to the open load of that cutoff.
Systemdock-scheduling EventDockAppointment Booked PolicyWhenever an outbound appointment names a cutoff, give its door to the open loadCommandBookAppointment started by the policyAggregateOutboundLoad EventLoadDoor Assigned Read model · kept up to dateAppointments copySource: application/usecases/book_appointment.go · domain/outboundload/commands.go · adapters/inbound/kafka/dock_yard_consumers.go
-
Start loading when the trailer docks
The yard reports a trailer at a door. If a planned load uses that door, the trailer is attached to it and loading starts.
Systemyard-management EventTrailerDocked PolicyWhenever a trailer docks at a load's door, attach it and start loadingCommandDockTrailer started by the policyAggregateOutboundLoad EventLoadingStarted Source: application/usecases/dock_trailer.go · domain/outboundload/commands.go
-
Stage a package
A dock operator scans a package into a staging spot, ready for its truck. Only a staging location of the package's own site is accepted.
ActorDock operatorRead modelStaging locationsCommandStagePackage POST /packages/{packageId}/stagingsAggregateShippingPackage EventPackageStaged Source: application/usecases/scan_package.go · domain/shippingpackage/commands.go · application/usecases/apply_layout.go
-
Load a package onto the truck
A dock operator scans the package at the door. It is accepted only for the load it belongs to, and only through that load's assigned door.
ActorDock operatorRead modelThe load and its doorCommandLoadPackage POST /packages/{packageId}/loadingsAggregateShippingPackage EventPackageLoaded Source: application/usecases/scan_package.go · domain/shippingpackage/commands.go
-
Take a package back off the truck
An operator removes a loaded package from its load. It goes back to staged, with an optional reason. A package that already shipped can no longer be unloaded.
ActorDock operatorCommandUnloadPackage POST /packages/{packageId}/unloadingsAggregateShippingPackage EventPackageUnloaded Source: application/usecases/scan_package.go · domain/shippingpackage/commands.go
-
Close the load
The supervisor closes the load once every package is loaded or short-shipped with a reason. Closing can list the packages to short-ship.
ActorDock supervisorCommandCloseLoad POST /loads/{loadId}/closuresAggregateOutboundLoad EventLoadClosed Source: application/usecases/load_commands.go · domain/outboundload/commands.go
-
Reopen a closed load
The supervisor puts a closed load back to loading so work can continue. A load whose shipment is already confirmed never reopens.
ActorDock supervisorCommandReopenLoad POST /loads/{loadId}/reopeningsAggregateOutboundLoad EventLoadReopened Source: application/usecases/load_commands.go · domain/outboundload/commands.go
-
Cancel a planned load
The supervisor cancels a load that never got going. It is refused once packages are assigned to it; those must be short-shipped and the load closed instead.
ActorDock supervisorCommandCancelLoad POST /loads/{loadId}/cancellationsAggregateOutboundLoad EventLoadCancelled Source: application/usecases/load_commands.go · domain/outboundload/commands.go
-
Confirm the shipment when the truck leaves
Only the yard's departure fact makes a shipment real. A departure with a seal, for a closed load, ships its loaded packages and tells order-management which orders left.
Systemyard-management EventTrailerDeparted PolicyWhenever a trailer leaves with a closed load and a seal, confirm the shipmentRead modelAppointments copyCommandConfirmShipment started by the policyAggregateOutboundLoad EventShipmentConfirmed Systemorder-management PolicyMarks the lines of the shipped orders as shippedSystemnetwork-fulfillment PolicyConfirms the network orders on the load as shippedSource: application/usecases/on_departure.go · domain/outboundload/commands.go · adapters/inbound/kafka/dock_yard_consumers.go
-
Issue the bill of lading
The moment the shipment is confirmed, one bill of lading is issued for the load, with the carrier, the yard's seal, the package count and the total weight.
Event · earlierShipmentConfirmed PolicyWhenever a shipment is confirmed, issue its bill of lading in the same stepCommandIssueBill started by the policyOf Lading AggregateBillOf Lading EventBillOf Lading Issued Source: application/usecases/on_departure.go · domain/billoflading/bol.go
-
Flag packages left behind at departure
If the truck leaves before the load was closed, nothing is confirmed. Every package that was not loaded is flagged as having missed its load, once, and a supervisor decides.
Systemyard-management EventTrailerDeparted PolicyWhenever a trailer leaves an unclosed load, flag each package not loadedCommandFlagMissed started by the policyLoad AggregateShippingPackage EventPackageMissed Load Systemorder-management PolicyRe-promises the order: recomputes its delivery promiseSystemexception-management PolicyOpens one case for the missed packageSource: application/usecases/on_departure.go · domain/shippingpackage/commands.go
-
Sweep for packages that missed the cutoff
An outside scheduler calls the sweep after a cutoff. Every package still expected or staged on an open load past its cutoff is flagged, and a re-run flags nothing twice.
TimeCutoff sweepPolicyEvery sweep, flag each package not loaded on an open load past its cutoffCommandSweepMissed POST /missed-load-sweepsLoads AggregateShippingPackage EventPackageMissed Load Systemorder-management PolicyRe-promises the order: recomputes its delivery promiseSystemexception-management PolicyOpens one case for the missed packageSource: application/usecases/sweep_missed.go · domain/shippingpackage/commands.go
-
Void a bill of lading
A supervisor voids an issued bill of lading and gives a reason. The shipment itself is not undone.
ActorDock supervisorCommandVoidBill POST /bills-of-lading/{bolNumber}/voidsOf Lading AggregateBillOf Lading EventBillOf Lading Voided Source: application/usecases/load_commands.go · domain/billoflading/bol.go
Hot spots and opportunities
Open questions and known gaps, each taken from a decision record or a document in the repository, never invented. Opportunities are improvements the documentation already names.
- Hot spotA truck that leaves before its load is closed never confirms the shipment, even if the load closes right after. Only a new departure would.
Source: adr/0002-ship-confirm-follows-the-physical-departure.md
- Hot spotNo bill of lading exists before departure, so a carrier that needs it in hand before leaving cannot be served yet.
Source: adr/0002-ship-confirm-follows-the-physical-departure.md
- Hot spotAn appointment that arrives before its load exists only saves a copy. The door is not assigned when the load is planned later.
- Hot spotNothing in this repository schedules the missed-load sweep. An outside scheduler has to call it.
Source: docs/ddd/eventstorming.md
- Hot spotAn order split over two loads yields two shipment events. Whether the retail network accepts a partial confirmation is still unchecked.
Source: adr/0004-shipment-confirmed-replaces-the-manual-network-confirmation.md
Opportunities
- OpportunityThe yard could react to loading started, load closed and load reopened. That consumer is deferred until the yard contract merges.
- OpportunityPallets, load sequencing and a master bill of lading are deliberately deferred; version one ships packages only.
This board is a reconstruction from the code and documentation of outbound-shipping at origin/develop, not a workshop output. Roles are the ones the documentation names. How the boards were made.