Skip to main content

Events

Source: apis/asyncapi.yaml (AsyncAPI 2.6), ADR 0005, internal/adapters/outbound/events/*.go, internal/adapters/kafka/cloudevents/cloudevents.go, internal/adapters/inbound/kafka/*.go. TestEventCatalogueMatchesContract fails the build when the contract declares a type that ADR 0005 does not list.

Envelope​

Every message is a CloudEvents 1.0 event in structured content mode, built only through internal/adapters/kafka/cloudevents.

AttributeValue
specversion1.0
idUUID minted once per occurrence, stored with the outbox row, stable across relay retries; consumers dedupe on it
source/warehouse/outbound-shipping
typecom.warehouse.wms.outbound-shipping.<entity>.<EventName>, entity one of outboundload, shippingpackage, billoflading
subjectthe aggregate id: load_id, package_id or bol_number (also the Kafka message key, hash-partitioned)
timeoccurred-at instant, UTC
datacontenttypeapplication/json
dataschemaurn:warehouse:outbound-shipping:<events|analytics>:<EventName>:v1
Kafka headercontent-type: application/cloudevents+json; charset=UTF-8

data is snake_case JSON; optional fields are omitted when unset, timestamps are RFC 3339, and every payload carries the aggregate version after the change, so a consumer can reject out-of-order deliveries.

Topics​

TopicDirectionContent
warehouse.outbound-shipping.eventspublishedthe integration stream, 13 types
warehouse.outbound-shipping.analyticspublished, and consumed by this servicethe same 13 types, same id, type, subject, key and payload; only the dataschema stream segment (analytics) differs. Not an integration contract: only the service's own projector reads it.
warehouse.fulfillment.eventsconsumedPackageManifested, PackageDiverted
warehouse.process-path-management.eventsconsumedCPTScheduleChanged
warehouse.facility.eventsconsumedZoneRegistered, LocationSlotRegistered
warehouse.dock-scheduling.eventsconsumedDockAppointmentBooked
warehouse.yard-management.eventsconsumedTrailerDocked, DoorWorkCompleted, TrailerDeparted

Both published streams are written by the same outbox in the same transaction, two rows per event.

Published events​

Type (after the com.warehouse.wms.outbound-shipping. prefix)Raised whendataIntegration consumers
outboundload.LoadPlannedthe first manifested package of a cutoff key plans a loadload_id, site_id, cpt_id, operating_date, ship_method, cutoff, versionanalytics only
outboundload.LoadDoorAssignedan outbound dock appointment names the load's cptload_id, site_id, door_code, appointment_id, versionanalytics only
outboundload.LoadingStarteda trailer docks at the load's doorload_id, site_id, door_code, trailer_id, started_at, versionyard-management (intended, not implemented)
outboundload.LoadClosedevery package is loaded or short-shippedload_id, site_id, door_code, trailer_id, package_count, short_shipped_count, closed_at, versionyard-management (intended, not implemented)
outboundload.LoadReopeneda supervisor reopens a closed loadload_id, site_id, reopened_at, versionyard-management (intended, not implemented)
outboundload.LoadCancelleda planned load is cancelledload_id, site_id, cancelled_at, versionanalytics only
outboundload.ShipmentConfirmedTrailerDeparted arrives for a CLOSED loadload_id, site_id, cpt_id, carrier, trailer_id, seal_number, departed_at, orders:[{order_id}], versionorder-management; network-fulfillment (intended, not implemented)
shippingpackage.PackageStageda package is stagedpackage_id, load_id, site_id, staging_location, staged_at, versionanalytics only
shippingpackage.PackageLoadeda package is loaded through its load's doorpackage_id, load_id, site_id, loaded_at, versionanalytics only
shippingpackage.PackageUnloadeda loaded package is taken back offpackage_id, load_id, site_id, unloaded_at, reason (optional), versionanalytics only
shippingpackage.PackageMissedLoada package missed its load: cutoff sweep, or a departure while the load was LOADINGpackage_id, load_id, site_id, source_order_id (optional), cutoff, detected_at, versionorder-management, exception-management
billoflading.BillOfLadingIssuedthe bill of lading is issued with the ship confirmationbol_number, load_id, site_id, carrier, carrier_scac (optional), trailer_id, seal_number, package_count, total_weight_g, issued_at, versionanalytics only
billoflading.BillOfLadingVoidedan issued bill of lading is voidedbol_number, load_id, site_id, reason, voided_at, versionanalytics only

Rules:

  • ShipmentConfirmed.orders lists every distinct source_order_id of the shipped packages, sorted; a package manifested without one is left out (ADR 0003). site_id of the event is the load's site.
  • PackageMissedLoad is raised at most once per package: the sweep and the departure-while-loading flag share a missed_flagged guard, so a re-run publishes nothing.
  • The consumers column is the intent of ADR 0005; the real state of each edge is on Integration. The asyncapi marks the three yard-bound types pending for that reason, and the other eight as analytics only by design.
  • LoadClosed.package_count counts loaded packages; short_shipped_count counts the short-ships recorded at close.
  • Events raised by use cases but not published: package assignment, MarkShipped and MarkShortShipped changes raise no event ("the model publishes none"); LoadClosed carries the short-ship count.

Consumed events​

All dispatch on the full type. The fields below are exactly the ones the code reads; other fields are ignored.

TypeTopicFields read
com.warehouse.wes.fulfillment-execution.package.PackageManifestedwarehouse.fulfillment.eventspackage_id, order_ref (stored verbatim, never parsed), site_id, source_order_id, cpt (RFC 3339 cutoff instant), weight_g. The last four are additive and optional.
com.warehouse.wes.fulfillment-execution.package.PackageDivertedwarehouse.fulfillment.eventspackage_id
com.warehouse.wes.process-path-management.cptschedule.CPTScheduleChangedwarehouse.process-path-management.eventssite_id, timezone, version, cutoffs[] of cpt_id, local_time, days_of_week, ship_method
com.warehouse.wms.facility-layout.zone.ZoneRegisteredwarehouse.facility.eventszoneId, siteCode, zoneCode (camelCase, as the producer sends them)
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegisteredwarehouse.facility.eventslocationCode, zoneId, role (absent on pre-role events: Storage)
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBookedwarehouse.dock-scheduling.eventsappointment_id, site_id, direction, door_code, carrier, carrier_scac, cpt_id, window_start, window_end, version; cpt_id and carrier_scac nullable
com.warehouse.wms.yard-management.trailer.TrailerDockedwarehouse.yard-management.eventstrailer_id, site_id, door_code, docked_at
com.warehouse.wms.yard-management.trailer.DoorWorkCompletedwarehouse.yard-management.eventstrailer_id, site_id, door_code, appointment_id, completed_at
com.warehouse.wms.yard-management.trailer.TrailerDepartedwarehouse.yard-management.eventstrailer_id, site_id, departed_at, seal_number (optional; no seal means no confirmation)

The own analytics consumer reads the 13 published types from warehouse.outbound-shipping.analytics. It acts on LoadPlanned, PackageStaged, PackageLoaded, PackageMissedLoad, LoadClosed, ShipmentConfirmed and LoadCancelled; the rest are claimed and ignored.

Handling guarantees (retry, dead letters, inbox) are on the runbook; the domain view of each event is on Domain events.