Skip to main content

Domain Message Flow

Following ddd-crew Domain Message Flow Modelling. Each scenario shows contexts and actors as participants and only real messages. Every arrow is numbered and prefixed:

  • cmd: — a command (REST write)
  • qry: — a query (REST GET or MCP tool)
  • evt: — a domain event (Kafka, CloudEvents 1.0; type prefix com.warehouse.wms.facility-layout. omitted inside the diagrams, written in full in the tables)

Downstream behaviour is taken from each consumer's own develop branch (see the Context map for file paths).

1. Commissioning a zone of the building​

An operator loads a new storage zone through the console micro-frontend, which calls this service's own REST API.

Source: internal/adapters/inbound/http/server.go, internal/application/usecases/register_*.go, define_placement_rule.go, import_facility_layout.go; consumers inventory-storage internal/adapters/outbound/facilitycache/consumer.go, warehouse-planning internal/adapters/inbound/kafka/storage_capacity_consumer.go. Omitted: the analytics topic copy of every event, the Idempotency-Key header on each creation POST, and per-row rejections (reported in the import response, no event).

2. Stow-time location check (inventory-storage)​

inventory-storage must not stow into a slot that does not exist, is retired, or sits in the wrong kind of zone. It has two modes, selected by its own LOCATION_LOOKUP_MODE.

Source: inventory-storage cmd/inventory/lookup.go, internal/adapters/outbound/facilitycache/consumer.go, internal/adapters/outbound/facilitylayout/client.go; this repo GetLocationClassification, ADR 0008, ADR 0013. Omitted: the inventory-storage stow command's own events. The former permissive mode (no check at all) was removed by inventory-storage's ADR 0042.

3. Retiring a slot​

A slot is permanently decommissioned; downstream caches drop it.

Source: internal/application/usecases/decommission_location_slot.go, register_location_slot.go (ErrDuplicateLocationCode), ADR 0005; fulfillment-execution internal/adapters/outbound/facilitylayout/client.go (LOCATION_ROLE_MODE=http, set in warehouse-infra). Omitted: the analytics copy and the 409 concurrent-modification branch.

4. Travel distance for planning and for the ops agent​

wes-work-planning prices travel between two locations; the ops agent asks the same question over MCP.

Source: internal/application/usecases/estimate_travel_distance.go, internal/domain/travel/graph.go, internal/adapters/inbound/mcp/tools.go; wes-work-planning internal/adapters/outbound/traveldistance/client.go; warehouse-ops-agent internal/adapters/outbound/mcpclient/facility_layout.go. Omitted: wes-work-planning's permissive default and circuit breaker; no event is produced (read model).

Message catalogue used above​

#MessageKindChannel
1RegisterSitecmdPOST /sites
2RegisterZonecmdPOST /sites/{siteCode}/zones
3RegisterAislecmdPOST /zones/{zoneId}/aisles
4RegisterLocationTypecmdPOST /location-types
5DefinePlacementRulecmdPOST /placement-rules
6ImportFacilityLayoutcmdPOST /location-imports
7RegisterLocationSlotcmdPOST /locations
8DecommissionLocationSlotcmdPOST /locations/{locationCode}/decommissionings
9GetLocationClassificationqryGET /locations/{locationCode}/classification
10GetLocationSlotqryGET /locations/{locationCode}
11EstimateTravelDistanceqryGET /distance, MCP estimate_travel_distance
12list_sites / get_site_layout / get_zone_gridqryMCP
13SiteRegisteredevtcom.warehouse.wms.facility-layout.site.SiteRegistered
14ZoneRegisteredevtcom.warehouse.wms.facility-layout.zone.ZoneRegistered
15AisleRegisteredevtcom.warehouse.wms.facility-layout.aisle.AisleRegistered
16LocationTypeRegisteredevtcom.warehouse.wms.facility-layout.locationtype.LocationTypeRegistered
17PlacementRuleDefinedevtcom.warehouse.wms.facility-layout.placementrule.PlacementRuleDefined
18LocationSlotRegisteredevtcom.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered
19LocationSlotDecommissionedevtcom.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned
20FacilityLayoutImportedevtcom.warehouse.wms.facility-layout.locationslot.FacilityLayoutImported