Skip to main content

Upstream contracts

inbound-receiving consumes four upstream contracts from three producers (product-master's products and pack levels, facility-layout's dock doors and, since ADR 0019, dock-scheduling's appointments), all to build local copies so it never calls a sibling at request time (ADR 0003). Each was read from the producer's apis/asyncapi.yaml on origin/develop and no contract contradicted the design. Messages are matched on the full CloudEvents type; unknown types are ignored. Every consumer always runs (ADR 0011) under its own required consumer group.

product-master: ProductRegistered​

ItemValue
Topicwarehouse.product-master.events (ProductTopic in internal/adapters/inbound/kafka/product_consumer.go)
Typecom.warehouse.wms.product-master.product.ProductRegistered (TypeProductRegistered), byte-identical to product-master's AsyncAPI
Consumer groupenv PRODUCT_CONSUMER_GROUP (required); the consumer always runs: since ADR 0011 the only PRODUCT_MODE is kafka, and an unset group is a boot error (loadConfig)
Fields useddata.sku only ({sku, description, version} are published; subject and key = the SKU)
Local copyknown_skus (sku, first_seen_at): existence only, so a replayed or reordered message is harmless
Idempotencyclaim of the CloudEvents id in processed_events under consumer product-registry, in the same unit of work as the upsert
EffectRegisterAsn rejects a SKU not in known_skus with 422 unknown-sku
Invalid inputnot a CloudEvent, malformed payload, invalid SKU: WARN and commit past
Transient failureretry the same message, 200 ms doubling to 5 s, until it succeeds; no dead-letter topic

product-master: pack levels (packaging view)​

ItemValue
Topicwarehouse.product-master.events (ProductTopic), read by a second consumer, PackagingConsumer in packaging_consumer.go, under its own group
Typescom.warehouse.wms.product-master.product.ProductPackLevelDeclared and ...ProductPackLevelRetired (TypePackLevelDeclared, TypePackLevelRetired), byte-identical to product-master's AsyncAPI; ProductRegistered belongs to the product consumer and ProductPackLevelMeasured is ignored
Consumer groupenv PACKAGING_CONSUMER_GROUP (required); the consumer always runs; a new group replays the topic from the start, so the view is complete on first run
Fields usedDeclared: sku, level, gtin, child_gtin, qty_of_child, units_per_pack, effective_from, version. Retired: gtin, effective_to, version (snake_case; key = the SKU)
Local copythe PackagingView (ADR 0013): GTIN to SKU, level and units per pack
Rulea declared level is upserted by its GTIN; a retired level is end-dated at effective_to; an event older than the stored version is ignored, and a retirement of an unknown GTIN changes nothing
Idempotencyclaim of the CloudEvents id under consumer packaging-view, in the same unit of work
EffectReceiveScan resolves a scanned GTIN to its SKU and pack level through the view (ADR 0013); an unknown GTIN is rejected and books nothing
Invalid inputWARN and commit past; transient failures retry

facility-layout: dock doors​

ItemValue
Topicwarehouse.facility.events (FacilityTopic in dock_door_consumer.go)
Typescom.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered and ...LocationSlotDecommissioned, byte-identical to facility-layout's AsyncAPI
Consumer groupenv DOCK_DOOR_CONSUMER_GROUP (required); the consumer always runs: since ADR 0011 the only DOCK_DOOR_MODE is kafka, and an unset group is a boot error
Fields usedlocationCode, role, dockFlow (camelCase: facility-layout carries its domain event struct verbatim); key = locationCode
Local copydock_doors (door_code, dock_flow, updated_at)
RuleLocationSlotRegistered with role=Dock and dockFlow Inbound or Both upserts a row. Any other registration (including an absent role, which means Storage, and Dock with dockFlow=Outbound) is ignored. LocationSlotDecommissioned deletes the row for that code
Idempotencyclaim of the CloudEvents id under consumer dock-door-registry, in the same unit of work
EffectGET /docks lists the known doors; OpenReceipt keeps the door code of its appointment
Invalid inputWARN and commit past

dock-scheduling: appointments​

ItemValue
Topicwarehouse.dock-scheduling.events (DockSchedulingTopic in dock_appointment_consumer.go)
Typescom.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBooked, ...DockAppointmentCancelled (ADR 0019), ...DockAppointmentRescheduled and ...DockAppointmentDoorReassigned (ADR 0020); every other type on the topic (NoShow, check-in, closures) is committed past. DoorReassigned is being moved onto the integration topic by dock-scheduling; until then it never arrives and nothing depends on it
Consumer groupenv DOCK_APPOINTMENT_CONSUMER_GROUP; the consumer always runs; unset is a boot error
Fields usedBooked: appointment_id, direction (only INBOUND is copied), door_code, carrier, window_start, window_end, asn_numbers[], version. Cancelled: appointment_id, version. Rescheduled: appointment_id, door_code, window_start, window_end, version (previous_door_code is logged; site_id, previous_window_*, arrival_tolerance_minutes are ignored). DoorReassigned: appointment_id, to_door_code, version (from_door_code is logged). All snake_case; key = appointment_id
Local copyappointments + appointment_asns
Rulean event applies only when its version is greater than the stored one (legacy rows are version 0, so any dock-scheduling version wins); all four types share that version line. Rescheduled moves door and window, DoorReassigned moves the door; neither creates a row, so one for an appointment not in the copy (an OUTBOUND one, or not seen yet) is ignored, its claim committed and logged at DEBUG. No later event revives a cancelled appointment: its data is refreshed, the state stays Cancelled
Idempotencyclaim of the CloudEvents id under consumer dock-appointment-copy, in the same unit of work as the update
No loopapplying an event writes nothing to the outbox
EffectOpenReceipt with an appointmentId requires it to exist (422 unknown-appointment), to cover the ASN (422 asn-not-on-appointment) and not be cancelled (409 appointment-cancelled), and takes the copy's current door. A receipt already open keeps its door (a physical fact); only receipts opened after a reschedule or reassignment take the new one. Deprecated GET /appointments reads the copy
Invalid inputempty ids, version < 1, empty door, window_end <= window_start: WARN and commit past; transient failures retry

yard-management: gate arrivals​

ItemValue
Topicwarehouse.yard-management.events (YardManagementTopic in visit_arrival_consumer.go)
Typescom.warehouse.wms.yard-management.yardvisit.VisitCheckedIn (ADR 0021); every other type on the topic (VisitRejected, TrailerDocked, TrailerDeparted, ...) is committed past
Consumer groupenv VISIT_ARRIVAL_CONSUMER_GROUP; the consumer always runs; unset is a boot error
Fields usedvisit_id, appointment_id (null for a walk-in visit), arrived_at, version. snake_case; key = visit_id. site_id, carrier, carrier_scac, purpose, trailers are ignored
Local copyvisit_arrivals (appointment_id, arrived_at, visit_id, updated_at)
Rulea visit with an appointment_id stores its arrived_at, keeping the earliest one seen (a redelivery or a later duplicate never moves it, whatever the order). A walk-in visit is ignored and claims nothing: a walk-in receipt has no arrival fact, so it has no dock-to-stock and is left out of the report
Idempotencyclaim of the CloudEvents id under consumer visit-arrival-copy, in the same unit of work
Effectevaluates the dock-to-stock fact of the receipt opened from that appointment and may raise ReceiptStowCompleted through this service's outbox, never anything towards yard-management
Invalid inputempty ids, version < 1, no arrived_at: WARN and commit past; transient failures retry. The topic may not exist yet: the reader retries and logs, readiness does not depend on it

inventory-storage: container stows​

ItemValue
Topicwarehouse.inventory.events (InventoryTopic in carton_stow_consumer.go)
Typescom.warehouse.wms.inventory-storage.container.ContainerStowed (ADR 0021); every other type is committed past, in particular ItemStowed, which has SKU and bin but no license plate and so cannot be joined to a carton
Consumer groupenv CARTON_STOW_CONSUMER_GROUP; the consumer always runs; unset is a boot error
Fields usedlpn, at. snake_case; key and subject = the LPN. sku, qty_eaches, owner_ref, site_id, bin are ignored
Local copycarton_stows (lpn, stowed_at, updated_at)
Rulestores the earliest at seen for the LPN: a later move of the container to another bin is not a new stow. A receipt carton joins by its SSCC, which is its LPN
Idempotencyclaim of the CloudEvents id under consumer carton-stow-copy, in the same unit of work
Effectevaluates the dock-to-stock fact of the receipts holding that carton and may raise ReceiptStowCompleted through this service's outbox, never anything towards inventory-storage
Invalid inputempty lpn, no at: WARN and commit past; transient failures retry

Modes​

CopyMode envGroup envDefault
known_skusPRODUCT_MODE = kafka (only value)PRODUCT_CONSUMER_GROUP (required)kafka
PackagingViewnone (always on)PACKAGING_CONSUMER_GROUP (required)n/a
dock_doorsDOCK_DOOR_MODE = kafka (only value)DOCK_DOOR_CONSUMER_GROUP (required)kafka
appointmentsnone (always on)DOCK_APPOINTMENT_CONSUMER_GROUP (required)n/a
visit_arrivalsnone (always on)VISIT_ARRIVAL_CONSUMER_GROUP (required)n/a
carton_stowsnone (always on)CARTON_STOW_CONSUMER_GROUP (required)n/a

The consumers always run and the copies are always consulted: permissive and off are boot errors since ADR 0011. The first start under a new group replays the topic from the first offset; readiness does not wait for it, so writes can answer 422 until the copies have replayed. The copies are eventually consistent: a SKU registered seconds ago may be rejected until its event is consumed, and the operator retries.

Not consumed​

Nothing else. inbound-receiving has no outbound HTTP client and reads no other topic (ADR 0001, "No live cross-context lookup, in either direction").

ADR 0003 vs the code​

ADR 0003 says the known_skus row "keeps the highest version". The schema and ApplyProductRegistered only store existence (known_skus has no version column, SkuStore.Upsert(ctx, sku) takes only the SKU, and the insert is ON CONFLICT (sku) DO NOTHING). Because only existence matters, replays and reordering are harmless either way; this page follows the code.