Skip to main content

ADR 0005: CloudEvents envelope and type catalogue

Status​

Accepted (2026-11-06). This ADR must exist before apis/asyncapi.yaml is committed: TestEventCatalogueMatchesContract fails any push where the contract declares a type for this service that this catalogue does not list.

Context​

Every Kafka message in the fleet is a CloudEvents 1.0 event in structured mode (fleet rule .claude/rules/fleet/cloudevents.md, warehouse-docs docs/strategic-design/event-standard-cloudevents.md). This service is WMS subdomain (wms, decision D2): its type prefix is com.warehouse.wms.outbound-shipping.<entity>.<EventName>. This ADR is the catalogue of every type outbound-shipping publishes or consumes.

Decision​

Envelope​

  • specversion 1.0; id a UUID minted once per occurrence and persisted with the outbox row (stable across relay retries; consumers dedupe on it); source /warehouse/outbound-shipping; subject the aggregate root id (loadId, packageId or bolNumber), also the Kafka partition key; time the occurred-at instant in UTC; datacontenttype application/json; dataschema urn:warehouse:outbound-shipping:events:<EventName>:v1.
  • Kafka value = the JSON event format; header content-type: application/cloudevents+json; charset=UTF-8; Kafka key = the aggregate id (kafkago.Hash{}), so all events of one aggregate stay ordered on one partition.
  • data is snake_case; optional fields are omitted when unset; every event payload carries the aggregate version AFTER the change (the model's version convention), so consumers can reject out-of-order deliveries.
  • Built and decoded only through internal/adapters/kafka/cloudevents.

Published on warehouse.outbound-shipping.events (+ warehouse.outbound-shipping.analytics)​

<entity> is the raising aggregate, lowercase, NO separators: outboundload, shippingpackage, billoflading. Every type below is published on BOTH streams under one id per occurrence; only the dataschema stream segment differs. The consumers column names the INTEGRATION consumers; the service's own projector also folds every type from the analytics stream.

typeraised whendataintegration consumers
com.warehouse.wms.outbound-shipping.outboundload.LoadPlannedthe first manifested package plans a load for its (site, cpt, date, ship method){load_id, site_id, cpt_id, operating_date, ship_method, cutoff, version}analytics only
com.warehouse.wms.outbound-shipping.outboundload.LoadDoorAssignedan outbound dock appointment names the load's cpt{load_id, site_id, door_code, appointment_id, version}analytics only
com.warehouse.wms.outbound-shipping.outboundload.LoadingStartedloading begins at a door with a docked trailer{load_id, site_id, door_code, trailer_id, started_at, version}yard-management
com.warehouse.wms.outbound-shipping.outboundload.LoadClosedevery package is loaded or short-shipped with a reason{load_id, site_id, door_code, trailer_id, package_count, short_shipped_count, closed_at, version}yard-management
com.warehouse.wms.outbound-shipping.outboundload.LoadReopeneda supervisor reopens a closed load{load_id, site_id, reopened_at, version}yard-management
com.warehouse.wms.outbound-shipping.outboundload.LoadCancelleda planned load is cancelled{load_id, site_id, cancelled_at, version}analytics only
com.warehouse.wms.outbound-shipping.outboundload.ShipmentConfirmedTrailerDeparted arrives for a CLOSED load (ADR 0002){load_id, site_id, cpt_id, carrier, trailer_id, seal_number, departed_at, orders:[{order_id}], version}order-management, network-fulfillment
com.warehouse.wms.outbound-shipping.shippingpackage.PackageStageda package is staged at a Staging location{package_id, load_id, site_id, staging_location, staged_at, version}analytics only
com.warehouse.wms.outbound-shipping.shippingpackage.PackageLoadeda package is loaded through its load's door{package_id, load_id, site_id, loaded_at, version}analytics only
com.warehouse.wms.outbound-shipping.shippingpackage.PackageUnloadeda loaded package comes back off the load{package_id, load_id, site_id, unloaded_at, reason, version}analytics only
com.warehouse.wms.outbound-shipping.shippingpackage.PackageMissedLoada package missed its load (departure while LOADING, cutoff sweep, or re-run){package_id, load_id, site_id, source_order_id, cutoff, detected_at, version}exception-management, order-management
com.warehouse.wms.outbound-shipping.billoflading.BillOfLadingIssuedthe BOL is issued with the ship confirmation{bol_number, load_id, site_id, carrier, trailer_id, seal_number, package_count, total_weight_g, issued_at, version}analytics only
com.warehouse.wms.outbound-shipping.billoflading.BillOfLadingVoidedan issued BOL is voided{bol_number, load_id, site_id, reason, voided_at, version}analytics only

Payload rules:

  • ShipmentConfirmed.orders lists every distinct source_order_id of the shipped packages; a package manifested without one is excluded and counted in analytics only (ADR 0003).
  • PackageMissedLoad is raised at most once per package and load: the sweep is idempotent and a re-run publishes nothing.
  • PackageUnloaded.reason is the operator's reason, omitted when none was given. A breaking payload change is a new .v2 type and dataschema, never a mutation of v1.

Consumed​

typetopickey data
com.warehouse.wes.fulfillment-execution.package.PackageManifestedwarehouse.fulfillment.eventspackage_id, order_ref (+ site_id, source_order_id, cpt, weight_g additive, ADR 0003)
com.warehouse.wes.fulfillment-execution.package.PackageDivertedwarehouse.fulfillment.eventspackage_id
com.warehouse.wes.process-path-management.cptschedule.CPTScheduleChangedwarehouse.process-path-management.eventssite_id, timezone, cutoffs (local CPT copy)
com.warehouse.wms.facility-layout.zone.ZoneRegisteredwarehouse.facility.eventszone to site mapping
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegisteredwarehouse.facility.eventsstaging locations (role, zoneId)
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBookedwarehouse.dock-scheduling.eventsdirection=OUTBOUND only; cpt_id, carrier_scac nullable — pinned from the producer's origin/feature/service until it merges (spike Q5)
com.warehouse.wms.yard-management.trailer.TrailerDockedwarehouse.yard-management.eventspinned from the producer's merged contract (ADR 0006)
com.warehouse.wms.yard-management.trailer.DoorWorkCompletedwarehouse.yard-management.eventssame
com.warehouse.wms.yard-management.trailer.TrailerDepartedwarehouse.yard-management.eventstrailer_id, site_id, departed_at, load_state, seal_number; same

Every other type on those topics is ignored. A message that is not a valid CloudEvent is logged and skipped, never retried forever. The dock-scheduling and yard-management rows are re-pinned from each producer's origin/develop AsyncAPI before fleet wiring lands (orchestrator sequencing note, 2026-11-05).

Analytics stream​

Every published event above is ALSO written, in the same transaction and under the same id, to warehouse.outbound-shipping.analytics. The type, subject, Kafka key and payload are identical to the integration message; only the dataschema stream segment differs (urn:warehouse:outbound-shipping:analytics:<EventName>:v1). That stream is not an integration contract: only this service's own projector consumes it.