Event Standard: CloudEvents 1.0 is the ONLY event envelope
Every Kafka message any warehouse-systems service produces or consumes —
integration topics warehouse.<ctx>.events and analytics topics
warehouse.<ctx>.analytics — is a CloudEvents 1.0 event in structured
content mode. There is no flat envelope, no dual-write, no dual-read and no
envelope toggle (EVENT_ENVELOPE_MODE is gone). Each service repository
records this standard as its own ADR, "CloudEvents 1.0 as the mandatory
event envelope" (see the ADR index).
This page is the fleet-level copy of the standard. The per-context
Async API pages describe each context's own topics and payloads;
the generated Async API reference is rendered from each
context's apis/asyncapi.yaml.
Example on the wire
Kafka header content-type: application/cloudevents+json; charset=UTF-8
(plus traceparent/tracestate), key = aggregate id, value:
{
"specversion": "1.0",
"id": "1d7e4b90-3c58-4d22-9a6f-8b1c0e5d7a23",
"source": "/warehouse/wes-work-planning",
"type": "com.warehouse.wes.work-planning.workunit.WorkReleased",
"subject": "wu-10231",
"time": "2026-08-21T22:12:30Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:wes-work-planning:events:WorkReleased:v1",
"data": {
"path_id": "pick-to-tote",
"work_unit_id": "wu-10231",
"cpt": "2026-08-22T02:00:00Z",
"ref": "order-88421-line-3"
}
}
Status: Accepted, fleet-wide, 2026-09-30. Supersedes every "flat envelope"
(event_id/event_type/occurred_at/source/data), the analytics
"Envelope v1" (schema_version), and the dual-envelope migrations
(fulfillment-execution ADR-0027, wes-work-planning ADR-0021).
1. Scope
EVERY message any warehouse-systems service writes to or reads from Kafka is
a CloudEvents 1.0 event. That includes integration topics
(warehouse.<ctx>.events) AND internal analytics topics
(warehouse.<ctx>.analytics). No exceptions, no coexistence.
- There is NO flat envelope, NO dual-write, NO dual-read, NO
EVENT_ENVELOPE_MODE(or any other envelope toggle). Delete them. - Publishers emit only CloudEvents. Consumers accept only CloudEvents.
2. Encoding: Kafka protocol binding, structured content mode
- Structured mode per the CloudEvents Kafka Protocol Binding: the Kafka
message VALUE is the JSON event format (
application/cloudevents+json). - Every produced message carries Kafka header
content-type: application/cloudevents+json; charset=UTF-8. - Kafka message KEY is unchanged from each publisher's current
partition-affinity choice (aggregate id). Keep
kafkago.Hash{}balancer. - W3C trace context stays in Kafka headers (
traceparent/tracestate) as today. Do NOT duplicate it into CloudEvents extension attributes. - Build, validate and (un)marshal events with the official SDK event package
github.com/cloudevents/sdk-go/v2/event(latest v2, currently v2.16.2):event.New(), setters,e.Validate(),json.Marshal(e)/json.Unmarshal(b, &e),e.DataAs(&payload). Do NOT use the sdk-go protocol/client packages; transport stayssegmentio/kafka-go. Do NOT hand-roll CloudEvent structs. - Put the CloudEvents helpers in ONE place per repo:
internal/adapters/kafka/cloudevents/(constants,New(...)builder,Decode([]byte) (event.Event, error)which validates). Publishers and consumers both use it.
3. Context attributes (all REQUIRED in this fleet)
| attribute | value |
|---|---|
specversion | 1.0 |
id | UUID v4, minted ONCE per domain event and persisted with the outbox row, so a redelivery carries the same id. (source, id) is the consumer idempotency key. |
source | /warehouse/<repo-name> (URI-reference), e.g. /warehouse/order-management, /warehouse/wes-work-planning. Same for integration and analytics topics. |
type | com.warehouse.<subdomain>.<bounded-context>.<entity>.<EventName> (§4) |
subject | id of the aggregate instance the event is about (order id, task id, path id, slot code, ...). Never empty. |
time | the domain event's occurred-at instant, UTC, RFC 3339 |
datacontenttype | application/json |
dataschema | urn:warehouse:<repo-name>:<stream>:<EventName>:v<N> where <stream> is events or analytics, N starts at 1. Absolute URI (spec requirement). This is what distinguishes the integration payload from the analytics payload of the same occurrence. |
datais the event payload JSON object, byte-for-byte the same payload shape each service publishes today (this is an envelope migration; do not rename payload fields).- No custom extension attributes unless an ADR justifies one. Extension names
must be lowercase
[a-z0-9], at most 20 chars. The old analyticsschema_versionfield is REMOVED (replaced bydataschema).
4. The type attribute
Convention (pre-existing platform standard, unchanged):
com.warehouse.<subdomain>.<bounded-context>.<entity>.<EventName>
- all segments lowercase except
<EventName>(PascalCase, past tense, exactly the domain event name). <entity>= the aggregate that raised it, lowercase, no separators.- The SAME type is used for the occurrence on both the integration and the
analytics topic (type names the occurrence;
dataschemanames the shape). - Versioning: additive payload changes keep the type and dataschema.
A BREAKING payload change requires a new
dataschemaversion AND a new type with a.v2suffix (e.g....order.OrderAllocated.v2), published as a new event, never by mutating the old one.
Subdomain and bounded-context segments (authoritative):
| repo | subdomain | bounded-context segment | source |
|---|---|---|---|
| facility-layout | wms | facility-layout | /warehouse/facility-layout |
| inventory-storage | wms | inventory-storage | /warehouse/inventory-storage |
| product-master | wms | product-master | /warehouse/product-master |
| inbound-receiving | wms | inbound-receiving | /warehouse/inbound-receiving |
| slotting-optimization | wms | slotting-optimization | /warehouse/slotting-optimization |
| pick-face-replenishment | wms | pick-face-replenishment | /warehouse/pick-face-replenishment |
| returns-processing | wms | returns-processing | /warehouse/returns-processing |
| dock-scheduling | wms | dock-scheduling | /warehouse/dock-scheduling |
| yard-management | wms | yard-management | /warehouse/yard-management |
| order-management | wes | order-management | /warehouse/order-management |
| process-path-management | wes | process-path-management | /warehouse/process-path-management |
| warehouse-planning | wes | warehouse-planning | /warehouse/warehouse-planning |
| network-fulfillment | wes | network-fulfillment | /warehouse/network-fulfillment |
| labor-performance | wes | labor-performance | /warehouse/labor-performance |
| workforce-management | wes | workforce-management | /warehouse/workforce-management |
| fulfillment-execution | wes | fulfillment-execution | /warehouse/fulfillment-execution |
| wes-work-planning | wes | work-planning | /warehouse/wes-work-planning |
| network-inventory-planning | wes | network-inventory-planning | /warehouse/network-inventory-planning |
| task-interleaving | wes | task-interleaving | /warehouse/task-interleaving |
| asrs-control | wes | asrs-control | /warehouse/asrs-control |
| exception-management | wes | exception-management | /warehouse/exception-management |
| outbound-shipping | wms | outbound-shipping | /warehouse/outbound-shipping |
dock-scheduling and yard-management (wms, proposed 2026-11-05, built on
develop and merged 2026-11-08, registered in warehouse-infra develop since
#193, released at v0.1.2 and applied to the k3s cluster on 2026-11-10 in a reduced footprint: dock-scheduling api only, yard-management api and relay): the type
prefixes com.warehouse.wms.dock-scheduling. and
com.warehouse.wms.yard-management. and the topics
warehouse.dock-scheduling.events / .analytics and
warehouse.yard-management.events / .analytics were pinned here before any
event shipped, so producers and consumers build against identical strings. The
design is the yard instance. The harness template's copy of the managed
fleet rule (warehouse-harness-template main,
.claude/rules/fleet/cloudevents.md) does not list the two names yet (checked
2026-11-10).
pick-face-replenishment and task-interleaving: both merged on develop
2026-10-17 (each publishes through a transactional outbox) and both run in the
reference cluster since 2026-10-20/21 (warehouse-infra#116, #121). Topics:
warehouse.pick-face-replenishment.events / .analytics (type prefix
com.warehouse.wms.pick-face-replenishment.) and
warehouse.task-interleaving.events / .analytics (type prefix
com.warehouse.wes.task-interleaving.).
returns-processing (wms) and exception-management (wes): scaffolded on
develop 2026-10-20 (ADR 0001 in each repo); contracts, domain and consumers
are in progress — their type prefixes
com.warehouse.wms.returns-processing. and
com.warehouse.wes.exception-management. are PINNED here so consumers and
producers build against identical strings before the first event ships.
outbound-shipping (wms): built on develop (2026-11-05 to 2026-11-09, ADR 0005 in its
repository pins the catalogue), released as v0.1.0 (2026-11-11), registered and image-pinned in
warehouse-infra develop (PR 205) and applied to the k3s cluster on 2026-11-12 (one api replica at 857edfd, so its events are published in the reference cluster; re-read 2026-11-13). Topics: warehouse.outbound-shipping.events / .analytics (type prefix
com.warehouse.wms.outbound-shipping., thirteen types, each on both topics).
What the subdomain segment means
The <subdomain> segment is a fixed label of the published contract, not an
industry software category (decided 2026-10-17):
wmsmarks the WMS tier: the item, location and inventory masters and the contexts that keep stock in place (receiving, slotting, replenishment, returns).wesmarks every other context, whether it executes work, manages labor, takes orders, plans capacity or balances the network.
A new context takes wms only under that definition. An existing segment is
never renamed to match an industry classification: every producer and consumer
matches the full type, so a rename is a breaking change everywhere at once
and tells no consumer anything new. By the industry definitions, only three of
the wes contexts are warehouse execution software; the
qualification records each context's industry
category (WMS, WES, labor management, above the WMS) with the evidence.
Entity segments for repos that had no catalogue yet:
- order-management: every
Order*event →order - process-path-management:
ProcessPath*→processpath;CPTScheduleChanged→cptschedule - network-fulfillment:
NetworkOrder*→networkorder - warehouse-planning:
CapacityPlan*/CapacityShortageDetected/BottleneckDetected→capacityplan - labor-performance:
LaborStandardDefined/LaborStandardRevised→standard;TaskPerformanceRecorded→performance - product-master: every
Product*event →product(product-master ADR 0004) - network-inventory-planning:
TransferPlanApproved/TransferAllocationRequested→transfer;WorkDemandReleased→workdemand(the name wes-work-planning's consumed contract uses); the analytics occurrencesTransferStateAdvanced/TransferStuckDetected/RebalanceRunCompleted→saga(network-inventory-planning ADR 0004) - inbound-receiving:
ASN*→asn;DockAppointment*→dockappointment(retired: the four types are no longer published, ADR 0022);Receipt*→receipt(inbound-receiving ADR 0004) - slotting-optimization: every
SlotPlan*event →slotplan(slotting-optimization ADR 0004) - pick-face-replenishment (built and deployed):
ReplenishmentRequested/ReplenishmentCompleted/ReplenishmentCancelled→replenishment;ReplenishmentPolicyDeclared(analytics only) →policy - task-interleaving (built and deployed):
InterleavingHintIssued/InterleavingHintConsumed/InterleavingHintExpired→stationtrip;InterleavingPolicyDeclared(analytics only) →policy - outbound-shipping (released v0.1.0, applied to k3s since 2026-11-12): every
Load*event andShipmentConfirmed→outboundload;Package*→shippingpackage;BillOfLading*→billoflading(outbound-shipping ADR 0005)
Repos that already have an AsyncAPI catalogue keep the entity segments already documented there. Events not yet in a catalogue get the entity of the aggregate that raises them.
Cross-service contract: these exact strings are consumed by another repo
Consumers MUST dispatch on the FULL type string (never a short name, never
a suffix match) and these must be byte-identical on both sides:
type | consumed by |
|---|---|
com.warehouse.wms.facility-layout.locationslot.LocationSlotRegistered | inventory-storage, warehouse-planning, inbound-receiving, slotting-optimization; pick-face-replenishment and task-interleaving (consumers deployed); outbound-shipping (consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wms.facility-layout.locationslot.LocationSlotDecommissioned | inventory-storage, warehouse-planning, inbound-receiving, slotting-optimization; pick-face-replenishment and task-interleaving (consumers deployed) |
com.warehouse.wms.facility-layout.zone.ZoneRegistered | inventory-storage, slotting-optimization; pick-face-replenishment and task-interleaving (consumers deployed); outbound-shipping (consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wms.facility-layout.locationslot.LocationGeometryUpdated | task-interleaving (consumer deployed; no other consumer); published by facility-layout |
com.warehouse.wms.facility-layout.site.SiteCapabilityChanged | network-inventory-planning |
com.warehouse.wms.inventory-storage.reservation.StockReserved | wes-work-planning |
com.warehouse.wms.inventory-storage.reservation.ReservationRevoked | wes-work-planning |
com.warehouse.wms.inventory-storage.reservation.TransferStockAllocated | network-inventory-planning |
com.warehouse.wms.inventory-storage.reservation.TransferStockAllocationRejected | network-inventory-planning |
com.warehouse.wms.inventory-storage.stock.TransferReceiptStaged | network-inventory-planning |
com.warehouse.wms.inventory-storage.stock.TransferStockStowed | network-inventory-planning |
com.warehouse.wms.inventory-storage.stock.StockRelocated | slotting-optimization (plan execution progress; inventory-storage ADR 0039, slotting-optimization ADR 0010); pick-face-replenishment (consumer deployed; closes a request only on reason == REPLENISHMENT, which inventory-storage records for a completed REPLENISH task, its ADR 0041, and which slotting-optimization ignores since its PR #35) |
com.warehouse.wms.inventory-storage.stock.BinStockLevelChanged | published by inventory-storage since its ADR 0040 (key <bin>:<sku>): pick-face-replenishment (consumer deployed) |
com.warehouse.wms.inventory-storage.product.ProductClassified | retiring: backfill-only after inventory-storage ADR 0034, consumed by product-master's legacy importer until stage E |
com.warehouse.wms.product-master.product.ProductRegistered | inbound-receiving |
com.warehouse.wms.product-master.product.ProductDescriptionChanged | (published contract; no consumer yet) |
com.warehouse.wms.product-master.product.ProductClassified | inventory-storage, order-management, wes-work-planning, fulfillment-execution (local copies; inventory-storage ADR 0034, order-management ADR 0036, wes-work-planning ADR 0035, fulfillment-execution ADR 0039), slotting-optimization |
com.warehouse.wms.product-master.product.ProductDimensionsDeclared | slotting-optimization |
com.warehouse.wms.product-master.product.ProductMeasured | slotting-optimization |
com.warehouse.wms.product-master.product.ProductPackLevelDeclared | inbound-receiving, inventory-storage, pick-face-replenishment, slotting-optimization, wes-work-planning, fulfillment-execution, network-inventory-planning (local pack views; context map K62) |
com.warehouse.wms.product-master.product.ProductPackLevelRetired | the same seven consumers (context map K62) |
com.warehouse.wms.product-master.product.ProductPackLevelMeasured | wes-work-planning, slotting-optimization (context map K62) |
com.warehouse.wms.inbound-receiving.asn.ASNRegistered | dock-scheduling, yard-management (the yard section; no row on the context map) |
com.warehouse.wms.inbound-receiving.asn.ASNCancelled | dock-scheduling, yard-management (the yard section; no row on the context map) |
com.warehouse.wms.inbound-receiving.dockappointment.DockAppointmentBooked | retired (inbound-receiving ADR 0022, stage E, on develop 2026-11-10): no longer declared or published; warehouse-planning read it under its ADR 0017 until its ADR 0020 switched the source to dock-scheduling (context map K28) |
com.warehouse.wms.inbound-receiving.dockappointment.DockAppointmentCheckedIn | retired (ADR 0022); had no consumer |
com.warehouse.wms.inbound-receiving.dockappointment.DockAppointmentCancelled | retired (ADR 0022); warehouse-planning read it under its ADR 0017 until its ADR 0020 switched the source to dock-scheduling (K28) |
com.warehouse.wms.inbound-receiving.dockappointment.DockAppointmentCompleted | retired (ADR 0022); had no consumer |
com.warehouse.wms.inbound-receiving.receipt.ReceiptOpened | yard-management (the yard section; no row on the context map) |
com.warehouse.wms.inbound-receiving.receipt.ReceiptLineReceived | inventory-storage (its ADR 0037) |
com.warehouse.wms.inbound-receiving.receipt.ReceiptClosed | yard-management (the yard section; no row on the context map) |
com.warehouse.wms.inbound-receiving.receipt.CartonDiscrepancyRaised | exception-management (its ADR 0006, one case per receipt, SSCC and kind; context map K66) |
com.warehouse.wms.slotting-optimization.slotplan.SlotPlanGenerated | (published contract; no consumer yet) |
com.warehouse.wms.slotting-optimization.slotplan.SlotPlanApproved | wes-work-planning (one RELOCATE work unit per move, its ADR-0040; slotting-optimization ADR 0010); pick-face-replenishment (forward map; consumer deployed) |
com.warehouse.wms.slotting-optimization.slotplan.SlotPlanRejected | (published contract; no consumer yet) |
com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentRequested | wes-work-planning (one REPLENISH work unit per request id, its ADR 0042; opt-in REPLENISHMENT_MODE=kafka, set in the reference deployment; the producer is deployed; context map K44, live) |
com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentCompleted | (published contract; no consumer: wes-work-planning reads the topic and ignores this type, its ADR 0042) |
com.warehouse.wms.pick-face-replenishment.replenishment.ReplenishmentCancelled | wes-work-planning (cancels the request's REPLENISH unit while it is still Pending, its ADR 0042; same opt-in as ReplenishmentRequested; producer deployed) |
com.warehouse.wes.order-management.order.OrderAllocated | wes-work-planning |
com.warehouse.wes.order-management.order.OrderPartiallyAllocated | wes-work-planning |
com.warehouse.wes.order-management.order.OrderRepromised | exception-management (auto-resolve correlation only, never a case source; context map K58) |
com.warehouse.wes.order-management.siteskudemand.SiteSkuDemandChanged | network-inventory-planning, slotting-optimization |
com.warehouse.wes.process-path-management.processpath.ProcessPathCreated | fulfillment-execution, wes-work-planning, workforce-management, order-management |
com.warehouse.wes.process-path-management.processpath.ProcessPathUpdated | same four |
com.warehouse.wes.process-path-management.processpath.ProcessPathDeactivated | same four |
com.warehouse.wes.process-path-management.cptschedule.CPTScheduleChanged | order-management; outbound-shipping (cutoff schedule copy; consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wes.labor-performance.performance.TaskPerformanceRecorded | workforce-management (and labor-performance itself) |
com.warehouse.wes.workforce-management.shiftplan.ShiftPlanCommitted | wes-work-planning, warehouse-planning |
com.warehouse.wes.fulfillment-execution.task.TaskCompleted | wes-work-planning, labor-performance, inventory-storage (picks, and RELOCATE moves via the additive RELOCATE fields, fulfillment-execution ADR 0047, and REPLENISH moves via the additive request_ref, fulfillment-execution ADR 0050 and inventory-storage ADR 0041); task-interleaving (consumer deployed); warehouse-planning (observed capacity, its ADR 0017) |
com.warehouse.wes.fulfillment-execution.task.TaskAvailable | published by fulfillment-execution since its ADR 0049, for RELOCATE and REPLENISH tasks only (the tasks that carry bins; ADR 0050): task-interleaving (consumer deployed) |
com.warehouse.wes.fulfillment-execution.task.TaskClaimed | published on the integration topic by fulfillment-execution since its ADR 0049 (the analytics-topic occurrence is separate): task-interleaving (consumer deployed) |
com.warehouse.wes.fulfillment-execution.task.TaskCPTMissed | order-management |
com.warehouse.wes.fulfillment-execution.package.PackageManifested | order-management; returns-processing; outbound-shipping (plans the load; consumer running (applied to k3s 2026-11-12); ignores a manifest without site_id, which the producer omits today) |
com.warehouse.wes.fulfillment-execution.package.PackageDiverted | exception-management; outbound-shipping (short-ships the package with reason DIVERTED; consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wes.fulfillment-execution.transfer.TransferPicked | network-inventory-planning |
com.warehouse.wes.fulfillment-execution.transfer.TransferDispatched | network-inventory-planning |
com.warehouse.wes.fulfillment-execution.transfer.TransferArrived | network-inventory-planning (reserved kind; scan-driven receiving can bypass it) |
com.warehouse.wes.work-planning.workunit.WorkReleased | fulfillment-execution (also the additive relocation object on the RELOCATE path, its ADR 0047, and the additive replenishment object on the REPLENISH path, its ADR 0050, produced by wes-work-planning's ADR 0042) |
com.warehouse.wes.work-planning.workunit.WorkUnitCreated | order-management (its ADR 0043; reads only the optional reference and line_no that wes-work-planning's ADR 0041 added; off by default, RELEASE_CONFIRMATION_MODE, not set in the reference deployment) |
com.warehouse.wes.work-planning.workpool.PathCapacityChanged | order-management |
com.warehouse.wes.warehouse-planning.capacityplan.CapacityPlanCreated | order-management (its ADR 0031; opt-in PLANNED_CAPACITY_CONSUMER_GROUP, set in the reference deployment) |
com.warehouse.wes.warehouse-planning.capacityplan.CapacityPlanPublished | network-inventory-planning (needs the additive site_id; a legacy event without it is excluded); order-management (its ADR 0031; opt-in PLANNED_CAPACITY_CONSUMER_GROUP, set in the reference deployment) |
com.warehouse.wes.warehouse-planning.capacityplan.CapacityShortageDetected | order-management (its ADR 0031; opt-in PLANNED_CAPACITY_CONSUMER_GROUP, set in the reference deployment) |
com.warehouse.wes.warehouse-planning.capacityplan.BottleneckDetected | (published contract; order-management's planned-capacity consumer reads the topic but ignores this type) |
com.warehouse.wes.network-inventory-planning.transfer.TransferPlanApproved | (published contract; no consumer yet) |
com.warehouse.wes.network-inventory-planning.transfer.TransferAllocationRequested | inventory-storage |
com.warehouse.wes.network-inventory-planning.workdemand.WorkDemandReleased | wes-work-planning |
com.warehouse.wes.task-interleaving.stationtrip.InterleavingHintIssued | published by task-interleaving (deployed); consumed by fulfillment-execution (advisory tie-break inside one priority band; its ADR 0051, context map K47, live) |
com.warehouse.wes.task-interleaving.stationtrip.InterleavingHintConsumed and ...InterleavingHintExpired, com.warehouse.wes.task-interleaving.policy.InterleavingPolicyDeclared | (analytics topic only; read by task-interleaving's own analytics projector; no other consumer) |
com.warehouse.wms.dock-scheduling.dockappointment.DockAppointmentBooked | outbound-shipping (OUTBOUND appointments naming a cpt_id assign the load's door; consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wms.yard-management.trailer.TrailerDocked | outbound-shipping (attaches the trailer and starts loading; consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wms.yard-management.trailer.DoorWorkCompleted | outbound-shipping (stored as a local copy; consumer running (applied to k3s 2026-11-12)) |
com.warehouse.wms.yard-management.trailer.TrailerDeparted | outbound-shipping (confirms a CLOSED load; consumer running (applied to k3s 2026-11-12); pinned and tested against the producer's contract, its ADR 0006) |
com.warehouse.wms.outbound-shipping.outboundload.ShipmentConfirmed | order-management (its ADR 0051; dark unless OUTBOUND_SHIPPING_CONSUMER_MODE=kafka); network-fulfillment is named by outbound-shipping ADR 0004 but has no handler |
com.warehouse.wms.outbound-shipping.shippingpackage.PackageMissedLoad | order-management (re-promise, its ADR 0051); exception-management (one case per package, its ADR 0011) |
com.warehouse.wms.outbound-shipping.outboundload.LoadingStarted, ...LoadClosed, ...LoadReopened | (published contract; yard-management is named by outbound-shipping ADR 0005 but has no handler) |
the other eight com.warehouse.wms.outbound-shipping. types (LoadPlanned, LoadDoorAssigned, LoadCancelled, PackageStaged, PackageLoaded, PackageUnloaded, BillOfLadingIssued, BillOfLadingVoided) | (analytics only by design; outbound-shipping's own projector reads them from its analytics topic) |
5. Consumer rules
- Decode with the SDK and
Validate(). A message that is not a valid CloudEvents 1.0 event (missingspecversion, legacy flat shape, bad JSON) is a deterministic poison message: send it to the repo's existing DLQ path if the consumer has one, otherwise log at WARN with topic/partition/offset and commit past it. NEVER crash, NEVER block the partition, NEVER fall back to parsing a flat envelope. - Dispatch on full
type. Unknown types are ignored silently (forward compatibility), not errors. - Idempotency/dedupe keys use the CloudEvents
id(existing processed-event tables keep their column, now populated fromid). - Read
time/subjectfrom the context attributes, payload fromDataAs.
6. Tests (required)
- Golden-file / exact-JSON unit test per published event type asserting all
§3 attributes, the type string, and the
content-typeheader. - A test that a legacy flat-envelope message is rejected (DLQ/skip) by every consumer, not parsed.
- Existing Kafka integration tests (testcontainers, never skip-gated, never hardcoded localhost:9092) updated to the CloudEvents wire format.
- Repo's full local gate green (
make check/ lefthook pre-push).
7. Documentation (required)
apis/asyncapi.yaml:defaultContentType: application/cloudevents+json, one CloudEvents envelope schema with every §3 attribute required, every message has its exacttypeconst anddataschema. Remove flat-envelope schemas and any "planned/ahead of the wire" caveats.- New ADR "CloudEvents 1.0 as the mandatory event envelope" (next number in the repo's sequence) stating this standard; mark older envelope ADRs (fe 0027, wes 0021, and any ADR describing the flat envelope) as "Superseded by ADR-NNNN". Register it in the ADR index/sidebar.
- README / docs pages / .claude/rules / .claude/skills that show the flat envelope are rewritten to the CloudEvents shape.
- CLAUDE.md and AGENTS.md carry the mandatory rule section (see CLAUDE-SECTION.md, verbatim, with the repo's own row filled in).
8. Cutover (no coexistence)
All service PRs merge and deploy as ONE set. Before deploying: drain each
service's outbox (rows were pre-encoded in the flat shape), then delete and
recreate the warehouse.*.events and warehouse.*.analytics topics and
re-seed the process-path catalogue, so no flat message remains for a
FirstOffset replay. See warehouse-infra docs/cloudevents-cutover.md.