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.

GitHub ↗ · Documentation ↗ · Architecture check · Briefings

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.

  1. Pivotal eventLoadPlanned
  2. Pivotal eventLoadClosed
  3. Pivotal eventShipmentConfirmed
  4. Pivotal eventBillOfLadingIssued

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
  1. 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 site
    CommandApplyCptSchedulestarted by the policy
    Read model · kept up to dateCutoff schedule

    Source: application/usecases/apply_cpt_schedule.go · adapters/inbound/kafka/cpt_layout_consumers.go

  2. 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 one
    Read modelCutoff schedule
    CommandExpectPackagestarted by the policy
    AggregateOutboundLoad
    EventLoadPlanned

    Source: application/usecases/expect_package.go · domain/outboundload/commands.go · adapters/inbound/kafka/fulfillment_consumer.go

  3. 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 close
    CommandDivertPackagestarted by the policy
    AggregateShippingPackage

    Source: application/usecases/divert_package.go · domain/shippingpackage/commands.go

  4. 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
    EventDockAppointmentBooked
    PolicyWhenever an outbound appointment names a cutoff, give its door to the open load
    CommandBookAppointmentstarted by the policy
    AggregateOutboundLoad
    EventLoadDoorAssigned
    Read model · kept up to dateAppointments copy

    Source: application/usecases/book_appointment.go · domain/outboundload/commands.go · adapters/inbound/kafka/dock_yard_consumers.go

  5. 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 loading
    CommandDockTrailerstarted by the policy
    AggregateOutboundLoad
    EventLoadingStarted

    Source: application/usecases/dock_trailer.go · domain/outboundload/commands.go

  6. 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 operator
    Read modelStaging locations
    CommandStagePackagePOST /packages/{packageId}/stagings
    AggregateShippingPackage
    EventPackageStaged

    Source: application/usecases/scan_package.go · domain/shippingpackage/commands.go · application/usecases/apply_layout.go

  7. 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 operator
    Read modelThe load and its door
    CommandLoadPackagePOST /packages/{packageId}/loadings
    AggregateShippingPackage
    EventPackageLoaded

    Source: application/usecases/scan_package.go · domain/shippingpackage/commands.go

  8. 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 operator
    CommandUnloadPackagePOST /packages/{packageId}/unloadings
    AggregateShippingPackage
    EventPackageUnloaded

    Source: application/usecases/scan_package.go · domain/shippingpackage/commands.go

  9. 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 supervisor
    CommandCloseLoadPOST /loads/{loadId}/closures
    AggregateOutboundLoad
    EventLoadClosed

    Source: application/usecases/load_commands.go · domain/outboundload/commands.go

  10. 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 supervisor
    CommandReopenLoadPOST /loads/{loadId}/reopenings
    AggregateOutboundLoad
    EventLoadReopened

    Source: application/usecases/load_commands.go · domain/outboundload/commands.go

  11. 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 supervisor
    CommandCancelLoadPOST /loads/{loadId}/cancellations
    AggregateOutboundLoad
    EventLoadCancelled

    Source: application/usecases/load_commands.go · domain/outboundload/commands.go

  12. 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 shipment
    Read modelAppointments copy
    CommandConfirmShipmentstarted by the policy
    AggregateOutboundLoad
    EventShipmentConfirmed
    Systemorder-management
    PolicyMarks the lines of the shipped orders as shipped
    Systemnetwork-fulfillment
    PolicyConfirms the network orders on the load as shipped

    Source: application/usecases/on_departure.go · domain/outboundload/commands.go · adapters/inbound/kafka/dock_yard_consumers.go

  13. 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 step
    CommandIssueBillOfLadingstarted by the policy
    AggregateBillOfLading
    EventBillOfLadingIssued

    Source: application/usecases/on_departure.go · domain/billoflading/bol.go

  14. 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 loaded
    CommandFlagMissedLoadstarted by the policy
    AggregateShippingPackage
    EventPackageMissedLoad
    Systemorder-management
    PolicyRe-promises the order: recomputes its delivery promise
    Systemexception-management
    PolicyOpens one case for the missed package

    Source: application/usecases/on_departure.go · domain/shippingpackage/commands.go

  15. 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 sweep
    PolicyEvery sweep, flag each package not loaded on an open load past its cutoff
    CommandSweepMissedLoadsPOST /missed-load-sweeps
    AggregateShippingPackage
    EventPackageMissedLoad
    Systemorder-management
    PolicyRe-promises the order: recomputes its delivery promise
    Systemexception-management
    PolicyOpens one case for the missed package

    Source: application/usecases/sweep_missed.go · domain/shippingpackage/commands.go

  16. Void a bill of lading

    A supervisor voids an issued bill of lading and gives a reason. The shipment itself is not undone.

    ActorDock supervisor
    CommandVoidBillOfLadingPOST /bills-of-lading/{bolNumber}/voids
    AggregateBillOfLading
    EventBillOfLadingVoided

    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.

Opportunities

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.