Consuming this service
Thirteen services consume facility-layout today: inventory-storage over
Kafka (with a REST fallback), inbound-receiving, dock-scheduling,
yard-management, outbound-shipping, slotting-optimization,
pick-face-replenishment, task-interleaving and warehouse-planning over
Kafka, network-inventory-planning over Kafka (SiteCapabilityChanged),
wes-work-planning and fulfillment-execution over REST, and
warehouse-ops-agent over MCP (plus the catalog-growth report REST). See the
Context map for the exact endpoints, events and switches
each one uses.
Integration styles, by need
| Need | Style | In use by |
|---|---|---|
| "Is this exact location valid, right now, before I accept this stow?" | Synchronous REST — GET /locations/{locationCode} or /classification | inventory-storage (LOCATION_LOOKUP_MODE=http), fulfillment-execution (role lookup) |
| "Keep a local read model of the building's structure in sync" | Event subscription — warehouse.facility.events | inventory-storage (LOCATION_LOOKUP_MODE=kafka), inbound-receiving (dock doors), dock-scheduling (dock doors), yard-management (yard spots and dock doors), outbound-shipping (layout copy), slotting-optimization, pick-face-replenishment, task-interleaving, warehouse-planning (storage-capacity tally), network-inventory-planning (site capability) |
| "How far apart are these two locations?" | Synchronous REST — GET /distance?from=&to= | wes-work-planning |
| "Let an agent explore the map" | MCP — cmd/mcp, Streamable HTTP | warehouse-ops-agent |
The two REST consumers (wes-work-planning, fulfillment-execution) keep a
permissive default in their binaries, which never reaches the network, but
warehouse-infra sets both to http, so in the cluster they do call this
service. inventory-storage has no permissive mode any more (its ADR 0042).
MCP tool errors. A failed tool call is an isError result whose text reads
<slug>: detail; the slug is the same problem slug the REST API reports for
that condition (site-not-found, malformed-location-code,
missing-location-code, …) and an unexpected failure is internal-error.
Classify on the slug, not on the prose — a *-not-found, unknown-*,
malformed-*, invalid-* or missing-* slug is a rejection of your input;
internal-error is a failure on this side
(ADR 0033). Text without a
slug (older servers) is unclassified.
Synchronous validation
The narrowest useful integration, and the one that needs nothing new:
curl -i localhost:8080/locations/WH1-STOR-AMB-A07-03-02-B
200with"status": "Active"→ the location is real and legal to use.200with"status": "Decommissioned"or"UnderMaintenance"→ it exists but must not be used for new work.404→ it is not on the map. Whatever produced that code is wrong.400→ the code is not seven valid[A-Z0-9]segments, so it was never a location at all.
The important property: because
PlacementRules are enforced at registration time,
a consumer that reads back an Active slot can treat it as
already-validated. It does not need to re-check temperature class,
hazmat, or capacity legality — that check already happened, once, before the
slot was allowed to exist. The consumer's job is a single existence-and-status
read, not a rules evaluation.
For structure rather than a single slot:
| Consumer question | Endpoint |
|---|---|
| What zones does this site have? | GET /sites/{siteCode}/zones |
| What aisles, in walk order? | GET /zones/{zoneId}/aisles — ordered by sequenceHint |
| The whole building at once | GET /sites/{siteCode}/layout |
| Where are the dock doors / work centers / yard spots? | GET /sites/{siteCode}/locations?role={LocationRole} |
| What is this slot for? | GET /locations/{locationCode} — the role field (plus dockFlow / activities) |
| Walkable topology of a zone | GET /zones/{zoneId}/travel-graph |
| Declared cross-aisle connections of a zone | GET /zones/{zoneId}/cross-aisles |
| Distance between two slots | GET /distance?from=&to= → {metresM, estimated, route} — routed over the zone's travel graph when both slots share a zone; across zones a straight-line estimate (estimated: true) only when both slots have recorded position geometry, otherwise 422 no-route-between-zones |
Event subscription
Consumers that need a local read model subscribe to this context's
domain events on the warehouse.facility.events
Kafka topic, specified in
apis/asyncapi.yaml.
The service always publishes there (Kafka is mandatory, ADR 0039). Each
message is a CloudEvents 1.0 event in structured content mode
(ADR-0024) — specversion,
id, source=/warehouse/facility-layout, type, subject (aggregate id),
time, datacontenttype, dataschema and data (the domain event's own
JSON) — with the Kafka header
content-type: application/cloudevents+json; charset=UTF-8. The Kafka key is
the identity of the aggregate that raised it, so per-aggregate order is
preserved — including the four ADR 0017 geometry/structure/cross-aisle
events (ADR 0032);
only FacilityLayoutImported, a batch outcome with no aggregate, is keyed by
its CloudEvents id (its subject is the fixed layout-import; kept by decision on 2026-10-06 — no consumer needs import ordering, and keying by site would be a contract change, ADR 0034; see
Domain events). Dispatch on the full type string (e.g.
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered),
dedupe on id, and DLQ/skip anything that fails CloudEvents validation.
The events a consumer is most likely to care about:
| Event | Consumer reaction |
|---|---|
LocationSlotRegistered | Add the location to the local map as usable. Payload carries zoneId, aisleId and role already, so no code parsing is needed. It may also carry an optional GS1 gln and, on a Yard slot, an optional spotKind (PARKING, HOLDING, REEFER_PLUG, HAZMAT, STAGING_LANE), both omitted when none was recorded (ADR-0045). |
LocationSlotHandlingUnitDeclared | Update the bin's handling unit (EACH/CASE/PALLET, last write wins per locationCode); LocationSlotRegistered carries the same optional handlingUnit. inventory-storage stows a sealed case only in a CASE/PALLET bin (ADR-0040). |
LocationSlotDecommissioned | Stop offering that location for new work. |
ZoneRegistered | Learn a new zone, its temperature class and hazmat flag, and its optional GS1 gln. |
AisleRegistered | Learn a corridor, its sequenceHint walk-order position and its direction. This is the travel-path input. |
AisleGeometryUpdated, CrossAisleRegistered, LocationGeometryUpdated | Keep a local copy of the travel geometry. No consumer applies the first two today; task-interleaving applies LocationGeometryUpdated. |
FacilityLayoutImported | Recognise a bulk load — useful for distinguishing a building bootstrap from ordinary drift. |
SiteCapabilityChanged (com.warehouse.wms.facility-layout.site.SiteCapabilityChanged) | Mirror which sites may donate (origin) or receive (destination) stock in an inter-warehouse transfer. A full last-write-wins snapshot (wire fields site_code, transfer_origin_enabled, transfer_destination_enabled, capability_revision, in snake_case, unlike every other event's camelCase payload; keep the highest revision, keyed by site code). Raised by PUT /sites/{siteCode}/transfer-capability once per real change, and as a periodic freshness heartbeat (same event type, current values, new id, fresh time = your as_of, revision + 1; every 5m by default, ADR-0041): the revision therefore rises by one per event of the site, not only per change, so compare values to detect a change; revision 1, 2, 3, … per site (ADR-0035; see Use cases). network-inventory-planning's site_capability read model is the consumer. A site with no event yet is capable of nothing. |
SiteRoleChanged (com.warehouse.wms.facility-layout.site.SiteRoleChanged) | Learn a site's role in the fulfilment network (siteCode, siteRole, previousSiteRole, camelCase). SiteRegistered also carries siteRole (additive). A role is NOT a transfer permission: capability arrives only as SiteCapabilityChanged (ADR-0037). Sites classified by the one-time migration 0009 backfill have no SiteRoleChanged: read their role on GET /sites. The per-role default capability table is GET /site-roles/transfer-defaults; no consumer reads roles today. |
inventory-storage is the reference consumer: it replays the topic from the
first offset on every start under a per-instance consumer group, uses
ZoneRegistered, LocationSlotRegistered, LocationSlotDecommissioned and
LocationSlotHandlingUnitDeclared, ignores the rest, and gates its readiness on the replay finishing
(ADR 0013).
warehouse-planning is the second: under a fixed consumer group it folds
LocationSlotRegistered (Storage slots by location type, WorkCenter slots
by activity) and LocationSlotDecommissioned into a capacity tally, deduping
on the CloudEvents id. inbound-receiving keeps only Inbound and Both dock
doors from LocationSlotRegistered (a decommission removes the row).
dock-scheduling keeps explicit Dock slots as bookable doors and
yard-management keeps Yard spots and Dock doors, both with a zone-to-site
join; outbound-shipping keeps zoneId and role from ZoneRegistered and
LocationSlotRegistered. slotting-optimization, pick-face-replenishment
and task-interleaving keep zone and slot copies (task-interleaving also
applies LocationGeometryUpdated).
Rules for a consumer
These apply to either style, and follow from this context being an Open Host Service its consumers are Conformist to.
Never write. No other context gets write access to a Site, Zone, Aisle, LocationType, PlacementRule or LocationSlot. The map has exactly one author.
Never re-derive the hierarchy by string surgery. A LocationCode looks
easy to split("-"), and every consumer that does it owns a copy of this
context's format forever. Use the zoneId and aisleId the API and the
events already give you.
Never re-implement PlacementRules. Duplicating the rule engine in a consumer recreates the exact problem the rule engine exists to prevent: two implementations that disagree the first time a rule changes.
Translate at your edge. Conformist does not mean "use LocationSlot as
your internal type." inventory-storage should keep its own Bin aggregate
and populate it from this context's facts; the two models have different
lifecycles and different reasons to change.
Expect one-way decommission. A retired code never comes back. A consumer
never has to handle a Decommissioned → Active transition, and should not
build one. See ADR 0005.
What this service will never do
So that no consumer waits for it:
- It will not track occupancy, stock, reservations or usable inventory.
- It will not know about Tasks, Assignments, Waves, Shifts or Associates.
- It will not plan work or optimise a pick path. It supplies map topology —
sequenceHint,direction, the travel graph and a shortest distance between two slots (GET /distance) — and the WES tier does the optimisation, because that optimisation is the WES tier's core domain./distancenever reports travel time or congestion. - It will not call another warehouse-systems service. Ever.