Skip to main content

Event catalogue

The contract is apis/asyncapi.yaml (AsyncAPI 3.0.0). Every message is CloudEvents 1.0 in structured mode, built and decoded only in internal/adapters/kafka/cloudevents. Field-level payloads are on Domain events.

Envelope​

AttributeValue
specversion1.0
ida UUID minted once, when the event is encoded into the outbox; a relay retry republishes the same id
source/retailnetwork/seller-inbound
typecom.retailnetwork.partner.seller-inbound.<entity>.<EventName>; entity seller, inboundplan, inboundshipment or placementplan
subjectthe aggregate root id: sellerId, planId or shipmentId (for SellerComplianceViolationRecorded, the sellerId)
timethe instant the fact became true
datacontenttypeapplication/json
dataschemaurn:retailnetwork:seller-inbound:<stream>:<EventName>:v1, stream events or analytics
Kafka keythe subject, so one aggregate's events stay ordered on one partition
Kafka headercontent-type: application/cloudevents+json; charset=UTF-8

Source: internal/adapters/kafka/cloudevents/cloudevents.go, internal/adapters/outbound/kafka/encoder.go.

Published​

Each event is appended to outbox_events in the same Postgres transaction as the change that raised it, then relayed by the in-process outbox relay. Delivery is at-least-once; consumers dedupe on id.

EventFull typeTopicRaised byConsumers
SellerOnboardedcom.retailnetwork.partner.seller-inbound.seller.SellerOnboardedretailnetwork.seller-inbound.analyticsOnboardSellernone in the organisation
SellerSuspendedcom.retailnetwork.partner.seller-inbound.seller.SellerSuspendedretailnetwork.seller-inbound.eventsSuspendSeller (not when already suspended)offer-availability (suppresses the seller's listings, ADR 0013)
SellerReinstatedcom.retailnetwork.partner.seller-inbound.seller.SellerReinstatedretailnetwork.seller-inbound.eventsReinstateSeller (not when already active)offer-availability (restores the seller's listings, ADR 0013)
InboundPlanConfirmedcom.retailnetwork.partner.seller-inbound.inboundplan.InboundPlanConfirmedretailnetwork.seller-inbound.analyticsConfirmInboundPlannone
InboundShipmentLabelledcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundShipmentLabelledretailnetwork.seller-inbound.eventsLabelShipmentvendor-connectivity
InboundShipmentShippedcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundShipmentShippedretailnetwork.seller-inbound.eventsShipInboundShipmentvendor-connectivity, node-performance
InboundShipmentReceivedcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundShipmentReceivedretailnetwork.seller-inbound.eventsApplyInboundReceipt, once, when the shipment closesvendor-connectivity; offer-availability (received: creates owner-scoped listings, gap G51, ADR 0014)
InboundDiscrepancyRecordedcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundDiscrepancyRecordedretailnetwork.seller-inbound.analyticsApplyInboundReceipt, per discrepancy, also while the shipment is RECEIVINGnone
SellerComplianceViolationRecordedcom.retailnetwork.partner.seller-inbound.seller.SellerComplianceViolationRecordedretailnetwork.seller-inbound.analyticsApplyInboundReceipt, per distinct compliance code of a cartonnone
PlacementPlanSuggestedcom.retailnetwork.partner.seller-inbound.placementplan.PlacementPlanSuggestedretailnetwork.seller-inbound.eventsplacement advisory compute (ADR 0012)none evidenced (analytics-only in v1)

The "none" consumers above are other contexts. This context's own analytics projector (cmd/si-projector, ADR 0017) reads InboundPlanConfirmed, PlacementPlanSuggested and InboundShipmentReceived from the two own topics into a separate analytical database; it acknowledges and skips the other seven types.

The routing is streamFor in encoder.go: the three shipment events, the two seller status events (ADR 0013) other contexts consume, and PlacementPlanSuggested (kept on the events topic so a consumer can subscribe later without a topic change) go to the events topic; every other fact goes to the analytics topic. Creating or cancelling a plan, creating a shipment and adding cartons publish nothing: a draft is private to the seller and the cartons travel with InboundShipmentLabelled.

Value sets: the shipment status of InboundShipmentReceived is CLOSED or CLOSED_WITH_DISCREPANCY; the carton status is RECEIVED, MISSING, UNEXPECTED or DAMAGED; the discrepancy kind is one of MissingCarton, UnexpectedCarton, Damaged, Short, Over (internal/domain/inboundshipment/receipt.go); the compliance code is passed through from the vendor's receipt, plus the context's own UNMANIFESTED_CARTON.

received of InboundShipmentReceived (ADR 0014) lists {catalogItemId?, gtin, qtyEaches} per gtin, sorted by gtin, over the manifest cartons answered RECEIVED (MISSING, DAMAGED and UNEXPECTED cartons do not count), from the vendor's counted quantities where the receipt reported them and from the manifest otherwise. gtin is the EACH-level GTIN when CatalogPackagingView resolves the carton GTIN to it, otherwise the carton GTIN; catalogItemId is omitted when the view does not resolve it; zero lines are omitted; the array is always present.

Consumed​

One consumer per topic, each under a mandatory consumer group; dispatch is on the full type; effects are idempotent on the CloudEvents id (processed_events).

ProducerTopicFull typeEffect
node-topologyretailnetwork.node-topology.eventscom.retailnetwork.logistics.node-topology.node.NodeRegisteredCreates the node in node_inbound_views.
node-topologyretailnetwork.node-topology.eventscom.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclaredReplaces the inbound limits if the revision is newer.
node-topologyretailnetwork.node-topology.eventscom.retailnetwork.logistics.node-topology.node.NodeActivatedStatus ACTIVE.
node-topologyretailnetwork.node-topology.eventscom.retailnetwork.logistics.node-topology.node.NodeSuspendedStatus SUSPENDED.
node-topologyretailnetwork.node-topology.eventscom.retailnetwork.logistics.node-topology.node.NodeRetiredStatus RETIRED (terminal).
offer-availabilityretailnetwork.offer-availability.eventscom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemPackagingDeclaredUpserts the pack level.
offer-availabilityretailnetwork.offer-availability.eventscom.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemPackLevelRetiredMarks the level inactive.
vendor-connectivityretailnetwork.vendor-connectivity.eventscom.retailnetwork.partner.vendor-connectivity.inboundreceipt.InboundReceiptSubmittedRecords the receipt on the shipment.
offer-availabilityretailnetwork.offer-availability.eventscom.retailnetwork.commerce.offer-availability.listing.ListingAvailabilityChangedUpserts the latest availability per item and node (listing_availability, availability half of the placement DemandHeatView, ADR 0012).
order-sourcingretailnetwork.order-sourcing.eventscom.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReleasedToNodeReplaces the assignment group's rows in demand_heat_lines with the released lines, one row per line (the demand half of the placement DemandHeatView, ADR 0012, ADR 0016). Extra fields of a merged release (members, per-line assignmentId, ownerRef) are ignored; the release instant is the CloudEvents time.
order-sourcingretailnetwork.order-sourcing.eventscom.retailnetwork.commerce.order-sourcing.assignment.FulfillmentCancelledDeletes the assignment group's demand_heat_lines rows; an unknown group is a no-op.

The contract lists eleven consumed types, and the eleven rows above are read by the four consumers cmd/api starts (node, catalog, receipt and sourcing, ADR 0016).

Failure handling (retry, dead letters, poison messages) is on Integration.

Rules for changing the catalogue​

Per CLAUDE.md: a new event is a domain struct, an entry in apis/asyncapi.yaml and the type: line in ADR 0004, in the same commit. The fleet catalogue test (TestEventCatalogueMatchesContract) matches com.warehouse.(wms|wes) and com.retailnetwork types, so it fails the build if one of this repository's published com.retailnetwork.partner.seller-inbound types is declared in the AsyncAPI file but missing from ADR 0004. CI api-lint runs Spectral on the AsyncAPI file.