Event catalog for the returns-processing bounded context (WMS subdomain): the reverse flow of goods — authorize a return against a shipped order line (RMA), receive and grade it (ReturnReceipt), decide what happens to it (Disposition) and hand restockable units back to inventory-storage as a staged line (ADR 0001, ADR 0002).
Published. Three aggregates define seven event types (six are raised
by a use case today; ReturnAuthorizationRejected is declared and
encodable but no use case raises it), published to
warehouse.returns-processing.events through a transactional outbox:
the aggregate row and its already-encoded events are written in ONE
database transaction and a relay drains them to Kafka (at-least-once; the
CloudEvents id is stored with the outbox row, so a retry republishes the
same id). ReturnLineStaged is the only type that asks a sibling to do
something: inventory-storage consumes it into its staged-receipt use case
(same shape as its ReceiptLineReceived plus rma_id, disposition_id,
site_id); UnexpectedReturnReceived is what exception-management turns
into a problem-solve case. Every one of the seven types is ALSO mirrored
on warehouse.returns-processing.analytics (dataschema
urn:warehouse:returns-processing:analytics:<EventName>:v1), the stream
this service's own projector consumes (ADR 0007).
Consumed (ADR 0003). ProductClassified from product-master, the
allocated order lines (OrderAllocated / OrderPartiallyAllocated) from
order-management and PackageManifested (the shipped fact per work unit,
order_ref = {order_id}-line-{line_no}) from fulfillment-execution.
Each feeds a durable local copy; no sibling is ever called live. A message
that is not a valid CloudEvents 1.0 event is skipped with a WARN log (its
offset is committed); a valid event of an unlisted type is ignored; a
payload that can never be applied (undecodable data, blank ids, a
order_ref that is not {order_id}-line-{line_no}) is dead-lettered to
<consumed topic>.dlq without retry; any other handler error is retried
and dead-lettered after 5 attempts. Consumer groups come from PRODUCT_CLASSIFICATION_CONSUMER_GROUP,
ORDER_LINES_CONSUMER_GROUP and MANIFEST_CONSUMER_GROUP. The consumed
messages below are the producers' own contracts, restated here and never
imported.
Envelope (mandatory). CloudEvents 1.0, structured content mode, Kafka
header content-type: application/cloudevents+json; charset=UTF-8.
The relay sets that one header only: no W3C trace-context headers
(traceparent / tracestate) are written. specversion, id, source (/warehouse/returns-processing), type,
subject, time, datacontenttype (application/json) and dataschema
(urn:warehouse:returns-processing:<events|analytics>:<EventName>:v1) are
all required. Kafka key = the subject. Type =
com.warehouse.wms.returns-processing.<entity>.<EventName>. A breaking
payload change is a new .v2 type, never a mutation.
Fleet-shared Kafka broker (host supplied by the deployment environment).
This service's integration topic. Written by the outbox relay; key = the
event's subject; every message carries the CloudEvents content-type
header. An outbox row that can never be encoded (malformed payload, an
event the service does not publish, an empty aggregate id) is written
verbatim to warehouse.returns-processing.events.dlq (headers
content-type: application/json and dlq-reason) instead.
Dispatch on the full type, ignore unknown types, dedupe on id.
Receive RMA, receipt and disposition events.
Subscribe to the reverse flow of goods: authorizations and their
rejections, arrivals and inspection grades, the policy decision per
inspected line and, only for a RESTOCK outcome, the staged line
handed to inventory-storage. Route on the full type
(com.warehouse.wms.returns-processing.<entity>.<EventName>).
Available only on servers:
Accepts one of the following messages:
An RMA was opened for a shipped order line inside the return window.
type = com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorized;
subject and key = the rmaId. window_ends_at is the policy window's
end (authorized_at + return window days); the goods must arrive before
it. quantity is capped by DispositionPolicy.max_units_per_line
(the shipped-quantity check is planned, ADR 0003).
2 units of SKU-1 from line 1 of order ord-7c9e may come back to WH1.
{
"specversion": "1.0",
"id": "9f2c1d3e-5a4b-4c6d-8e7f-1a2b3c4d5e6f",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorized",
"subject": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"time": "2026-10-21T09:30:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:ReturnAuthorized:v1",
"data": {
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"order_id": "ord-7c9e2f1a",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"site_id": "WH1",
"reason_code": "DAMAGED",
"window_ends_at": "2026-11-20T09:30:00Z",
"authorized_at": "2026-10-21T09:30:00Z"
}
}
An RMA request was refused: the line never shipped, the window closed or another RMA is open.
type = com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorizationRejected;
subject and key = the rmaId. rejection_code is LINE_NOT_MANIFESTED,
RETURN_WINDOW_EXPIRED, OPEN_RMA_EXISTS or
QUANTITY_EXCEEDS_POLICY. Not raised today: the domain, the
outbox payload mapping and the encoder support it, but no use case
calls the rejecting transition; POST /returns answers a refusal
with 409 and persists and publishes nothing. Declared for the day a
RejectReturn use case exists.
The order line has no manifested work unit, so nothing provably shipped.
{
"specversion": "1.0",
"id": "1e3f5a7c-9b1d-4f2a-8c3e-5d6f7a8b9c0d",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorizationRejected",
"subject": "rma-6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b90",
"time": "2026-10-21T09:31:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:ReturnAuthorizationRejected:v1",
"data": {
"rma_id": "rma-6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b90",
"order_id": "ord-7c9e2f1a",
"line_no": 2,
"sku": "SKU-2",
"quantity": 1,
"rejection_code": "LINE_NOT_MANIFESTED",
"rejected_at": "2026-10-21T09:31:00Z"
}
}
Returned goods arrived; each line matches an RMA line or is explicitly unexpected.
type = com.warehouse.wms.returns-processing.returnreceipt.ReturnReceiptOpened;
subject and key = the receiptId. rma_id is null when the whole
parcel was unexpected. Every line carries its own nullable rma_id: a
non-null value is a matched line, null means the line is UNEXPECTED
(there is no silent third state). UNEXPECTED lines additionally raise
UnexpectedReturnReceived for exception-management.
A parcel against one RMA with one matched line and one unexpected line.
{
"specversion": "1.0",
"id": "2f4a6b8c-0d2e-4a3b-9c4d-6e7f8a9b0c1d",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnreceipt.ReturnReceiptOpened",
"subject": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"time": "2026-10-22T14:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:ReturnReceiptOpened:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"site_id": "WH1",
"opened_at": "2026-10-22T14:05:00Z",
"lines": [
{
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80"
},
{
"line_no": 2,
"sku": "SKU-9",
"quantity": 1,
"rma_id": null
}
]
}
}
A receipt line was graded A, B, C or SCRAP with its reason codes.
type = com.warehouse.wms.returns-processing.returnreceipt.ReturnLineInspected;
subject and key = the receiptId. quantity is the inspected quantity,
never more than the received quantity of the line; a line is inspected
exactly once. The disposition is decided in the same transaction and
raises its own DispositionDecided.
Line 1 graded B for customer damage.
{
"specversion": "1.0",
"id": "3a5b7c9d-1e2f-4b3c-8d4e-7f8a9b0c1d2e",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnreceipt.ReturnLineInspected",
"subject": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"time": "2026-10-22T15:10:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:ReturnLineInspected:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"grade": "B",
"reason_codes": [
"CUSTOMER_DAMAGE"
],
"inspected_at": "2026-10-22T15:10:00Z"
}
}
A received line has no matching RMA; exception-management opens a case.
type = com.warehouse.wms.returns-processing.returnreceipt.UnexpectedReturnReceived;
subject and key = the receiptId. Raised per UNEXPECTED receipt line
(the receipt-level fact is ReturnReceiptOpened).
One unit of SKU-9 arrived with no RMA.
{
"specversion": "1.0",
"id": "4b6c8d9e-2f3a-4c4d-9e5f-8a9b0c1d2e3f",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnreceipt.UnexpectedReturnReceived",
"subject": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"time": "2026-10-22T14:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:UnexpectedReturnReceived:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 2,
"sku": "SKU-9",
"quantity": 1,
"site_id": "WH1",
"received_at": "2026-10-22T14:05:00Z"
}
}
The policy outcome for one inspected line: RESTOCK, REFURBISH, LIQUIDATE, DISPOSE or RTV.
type = com.warehouse.wms.returns-processing.disposition.DispositionDecided;
subject and key = the dispositionId. The decision is the pure function
Decide(grade, classification, policy) and records the
policy_version it used. An operator override is a NEW Disposition
whose supersedes names the original and whose reason is mandatory;
both fields are null on a policy decision.
Grade B of a standard SKU restocks (policy v3).
{
"specversion": "1.0",
"id": "5c7d9e0f-3a4b-4d5e-8f6a-9b0c1d2e3f4a",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.disposition.DispositionDecided",
"subject": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"time": "2026-10-22T15:10:01Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:DispositionDecided:v1",
"data": {
"disposition_id": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"grade": "B",
"outcome": "RESTOCK",
"policy_version": 3,
"supersedes": null,
"reason": null,
"decided_at": "2026-10-22T15:10:01Z"
}
}
A RESTOCK disposition hands the goods to inventory-storage as a staged receipt line.
type = com.warehouse.wms.returns-processing.disposition.ReturnLineStaged;
subject and key = the dispositionId. data is inbound-receiving's
ReceiptLineReceived shape (receipt_id, line_no, sku,
quantity, condition, received_at) plus rma_id (null for an
UNEXPECTED line), disposition_id and site_id; inventory-storage
consumes it into its staged-receipt use case and the stow stays an RF
action there. Raised
exactly once per RESTOCK disposition (idempotent on disposition_id);
no other outcome touches any sibling.
The 2 restockable units are staged at WH1.
{
"specversion": "1.0",
"id": "6d8e0f1a-4b5c-4e6f-9a7b-8c9d0e1f2a3c",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.disposition.ReturnLineStaged",
"subject": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"time": "2026-10-22T15:10:02Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:events:ReturnLineStaged:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"condition": "Good",
"received_at": "2026-10-22T14:05:00Z",
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"disposition_id": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"site_id": "WH1"
}
}
This service's own analytics stream (ADR 0007), written by the SAME
transactional outbox pass as the integration topic: every domain event
appears here too, under the SAME CloudEvents id, type, subject and
key and with a byte-identical payload; only the dataschema stream
segment differs
(urn:warehouse:returns-processing:analytics::v1). It is NOT
an integration contract: the only consumer is this service's
cmd/returns-projector (fixed group from ANALYTICS_CONSUMER_GROUP),
which folds five of the seven types into the analytical database (the
two authorization twins are acknowledged and ignored); its
deterministic poison goes to
warehouse.returns-processing.analytics.dlq. Other contexts keep reading
warehouse.returns-processing.events.
Receive the analytics twin of every domain event.
Payloads are byte-for-byte the integration payloads (ADR 0007);
only the dataschema names the analytics stream. The projector folds
ReturnReceiptOpened, UnexpectedReturnReceived,
ReturnLineInspected, DispositionDecided and ReturnLineStaged
into the analytical facts; ReturnAuthorized and
ReturnAuthorizationRejected answer no report and are ignored.
Available only on servers:
Accepts one of the following messages:
The analytics-stream twin of ReturnAuthorized (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnAuthorized:v1. Consumed only by cmd/returns-projector, which ignores it (no report answers the authorization funnel today).
The analytics twin of the authorized example above.
{
"specversion": "1.0",
"id": "9f2c1d3e-5a4b-4c6d-8e7f-1a2b3c4d5e6f",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorized",
"subject": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"time": "2026-10-21T09:30:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:ReturnAuthorized:v1",
"data": {
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"order_id": "ord-7c9e2f1a",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"site_id": "WH1",
"reason_code": "DAMAGED",
"window_ends_at": "2026-11-20T09:30:00Z",
"authorized_at": "2026-10-21T09:30:00Z"
}
}
The analytics-stream twin of ReturnAuthorizationRejected (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnAuthorizationRejected:v1. Consumed only by cmd/returns-projector, which ignores it.
The analytics twin of the rejected example above.
{
"specversion": "1.0",
"id": "1e3f5a7c-9b1d-4f2a-8c3e-5d6f7a8b9c0d",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorizationRejected",
"subject": "rma-6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b90",
"time": "2026-10-21T09:31:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:ReturnAuthorizationRejected:v1",
"data": {
"rma_id": "rma-6f7a8b9c-0d1e-4f2a-9b3c-4d5e6f7a8b90",
"order_id": "ord-7c9e2f1a",
"line_no": 2,
"sku": "SKU-2",
"quantity": 1,
"rejection_code": "LINE_NOT_MANIFESTED",
"rejected_at": "2026-10-21T09:31:00Z"
}
}
The analytics-stream twin of ReturnReceiptOpened (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnReceiptOpened:v1. The projector folds every carried line into its return_line_facts (the opened milestone).
The analytics twin of the opened example above.
{
"specversion": "1.0",
"id": "2f4a6b8c-0d2e-4a3b-9c4d-6e7f8a9b0c1d",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnreceipt.ReturnReceiptOpened",
"subject": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"time": "2026-10-22T14:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:ReturnReceiptOpened:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"site_id": "WH1",
"opened_at": "2026-10-22T14:05:00Z",
"lines": [
{
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80"
},
{
"line_no": 2,
"sku": "SKU-9",
"quantity": 1,
"rma_id": null
}
]
}
}
The analytics-stream twin of ReturnLineInspected (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnLineInspected:v1. The projector records the inspected milestone of the receipt line.
The analytics twin of the inspected example above.
{
"specversion": "1.0",
"id": "3a5b7c9d-1e2f-4b3c-8d4e-7f8a9b0c1d2e",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnreceipt.ReturnLineInspected",
"subject": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"time": "2026-10-22T15:10:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:ReturnLineInspected:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"grade": "B",
"reason_codes": [
"CUSTOMER_DAMAGE"
],
"inspected_at": "2026-10-22T15:10:00Z"
}
}
The analytics-stream twin of UnexpectedReturnReceived (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:UnexpectedReturnReceived:v1. The projector opens a return-line fact for the unexpected line (the opened milestone).
The analytics twin of the unexpected example above.
{
"specversion": "1.0",
"id": "4b6c8d9e-2f3a-4c4d-9e5f-8a9b0c1d2e3f",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.returnreceipt.UnexpectedReturnReceived",
"subject": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"time": "2026-10-22T14:05:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:UnexpectedReturnReceived:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 2,
"sku": "SKU-9",
"quantity": 1,
"site_id": "WH1",
"received_at": "2026-10-22T14:05:00Z"
}
}
The analytics-stream twin of DispositionDecided (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:DispositionDecided:v1. The projector records one disposition_facts row (the disposition-mix report's cell) and the decided milestone of the receipt line.
The analytics twin of the decided example above.
{
"specversion": "1.0",
"id": "5c7d9e0f-3a4b-4d5e-8f6a-9b0c1d2e3f4a",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.disposition.DispositionDecided",
"subject": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"time": "2026-10-22T15:10:01Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:DispositionDecided:v1",
"data": {
"disposition_id": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"grade": "B",
"outcome": "RESTOCK",
"policy_version": 3,
"supersedes": null,
"reason": null,
"decided_at": "2026-10-22T15:10:01Z"
}
}
The analytics-stream twin of ReturnLineStaged (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnLineStaged:v1. The projector records the staged milestone (the value-recovery and return-cycle-time reports' basis).
The analytics twin of the staged example above.
{
"specversion": "1.0",
"id": "6d8e0f1a-4b5c-4e6f-9a7b-8c9d0e1f2a3c",
"source": "/warehouse/returns-processing",
"type": "com.warehouse.wms.returns-processing.disposition.ReturnLineStaged",
"subject": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"time": "2026-10-22T15:10:02Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:returns-processing:analytics:ReturnLineStaged:v1",
"data": {
"receipt_id": "rcpt-8a9b0c1d-2e3f-4a5b-8c6d-7e8f9a0b1c2d",
"line_no": 1,
"sku": "SKU-1",
"quantity": 2,
"condition": "Good",
"received_at": "2026-10-22T14:05:00Z",
"rma_id": "rma-4d5e6f7a-8b9c-4d0e-a1f2-3b4c5d6e7f80",
"disposition_id": "disp-0c1d2e3f-4a5b-4e6f-9a7b-8c9d0e1f2a3b",
"site_id": "WH1"
}
}
product-master's integration topic. This service consumes ONLY
ProductClassified (subject and key = the SKU) under a stable consumer
group read from env PRODUCT_CLASSIFICATION_CONSUMER_GROUP. Every other
type on the topic is ignored.
Consume the product classification of each SKU.
ProductClassified feeds the product_classifications local copy: the
hazmat flag, DOT hazard class and temperature class that the
disposition policy keys on. A message is applied only when its
version is greater than the stored one for the SKU (grades stay
fail-open; RESTOCK of a hazmat SKU without a DOT rating stays
fail-closed). The CloudEvents id claim and the effect commit in one
transaction; the offset is committed afterwards (ADR 0003).
Available only on servers:
Accepts the following message:
The handling classification of a SKU, with a monotonically increasing version.
type = com.warehouse.wms.product-master.product.ProductClassified,
source /warehouse/product-master, dataschema
urn:warehouse:product-master:events:ProductClassified:v1. Subject and
Kafka key = the SKU. handling_tags can carry Hazmat and
TemperatureSensitive; dot_hazard_class is 0 when the SKU carries
no rating; classification_source is native or imported. Apply
only when version is greater than the stored one for the SKU. This
service reads sku, handling_tags, temperature_class,
dot_hazard_class and version and ignores classification_source;
handling_tags are stored verbatim (a dot:<n> tag is appended for a
non-zero dot_hazard_class). Restated from product-master's contract,
never imported.
SKU-1 is hazmat, temperature-sensitive and frozen, DOT class 3.
{
"specversion": "1.0",
"id": "7e9f1a2b-5c6d-4f7a-8b8c-9d0e1f2a3b4c",
"source": "/warehouse/product-master",
"type": "com.warehouse.wms.product-master.product.ProductClassified",
"subject": "SKU-1",
"time": "2026-10-18T08:00:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:product-master:events:ProductClassified:v1",
"data": {
"sku": "SKU-1",
"handling_tags": [
"Hazmat",
"TemperatureSensitive"
],
"temperature_class": "Frozen",
"dot_hazard_class": 3,
"classification_source": "native",
"version": 3
}
}
order-management's integration topic. This service consumes
OrderAllocated and OrderPartiallyAllocated (subject and key = the
order id) under a stable consumer group read from env
ORDER_LINES_CONSUMER_GROUP. Every other type on the topic is ignored.
Consume the allocated order lines.
The lines of both types feed the allocated_order_lines local copy:
one row per (order_id, line_no) with its SKU, refreshed on every
allocation event. The lines carry NO quantity; v1 therefore caps the
authorized quantity by DispositionPolicy.max_units_per_line and the
shipped-quantity check stays planned (ADR 0003). The CloudEvents id
claim and the effect commit in one transaction.
Available only on servers:
Accepts one of the following messages:
Every line of an order was allocated; the lines carry no quantity.
type = com.warehouse.wes.order-management.order.OrderAllocated,
source /warehouse/order-management, dataschema
urn:warehouse:order-management:events:OrderAllocated:v1. Subject and
Kafka key = the order id. The lines carry line_no, sku, path_id,
gift_wrap and fulfillment_class but NO quantity; this service
reads only order_id and each line's line_no and sku. Restated
from order-management's contract, never imported.
A one-line order allocated to the pick path.
{
"specversion": "1.0",
"id": "8f0a2b3c-6d7e-4a8b-9c9d-0e1f2a3b4c5d",
"source": "/warehouse/order-management",
"type": "com.warehouse.wes.order-management.order.OrderAllocated",
"subject": "ord-7c9e2f1a",
"time": "2026-10-19T10:01:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:order-management:events:OrderAllocated:v1",
"data": {
"order_id": "ord-7c9e2f1a",
"promise_date": "2026-09-09T10:01:00Z",
"lines": [
{
"line_no": 1,
"sku": "SKU-BOOK-0001",
"path_id": "pick",
"gift_wrap": false,
"fulfillment_class": "SAME_SKU_MULTI"
}
]
}
}
Some lines of an order were allocated; the same line shape as OrderAllocated.
type = com.warehouse.wes.order-management.order.OrderPartiallyAllocated,
source /warehouse/order-management, dataschema
urn:warehouse:order-management:events:OrderPartiallyAllocated:v1.
Subject and Kafka key = the order id. lines holds ONLY the allocated
lines, in the same shape as OrderAllocated (no quantity). Restated
from order-management's contract, never imported.
Line 1 of the order allocated, line 2 not yet.
{
"specversion": "1.0",
"id": "9a1b3c4d-7e8f-4b9c-8d0e-1f2a3b4c5d6e",
"source": "/warehouse/order-management",
"type": "com.warehouse.wes.order-management.order.OrderPartiallyAllocated",
"subject": "ord-7c9e2f1a",
"time": "2026-10-19T10:03:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:order-management:events:OrderPartiallyAllocated:v1",
"data": {
"order_id": "ord-7c9e2f1a",
"promise_date": "2026-09-09T10:01:00Z",
"lines": [
{
"line_no": 1,
"sku": "SKU-BOOK-0001",
"path_id": "pick",
"gift_wrap": false,
"fulfillment_class": "SAME_SKU_MULTI"
}
]
}
}
fulfillment-execution's integration topic. This service consumes ONLY
PackageManifested (subject and key = the package id) under a stable
consumer group read from env MANIFEST_CONSUMER_GROUP. Every other type
on the topic is ignored.
Consume the manifested work units (the shipped fact).
PackageManifested feeds the manifested_work_units local copy after
reversing order_ref (a WES work unit id {order_id}-line-{line_no})
into (order_id, line_no). A return is authorizable only against a line
whose work unit appears in this copy (ADR 0002, invariant 2). The
CloudEvents id claim and the effect commit in one transaction.
Available only on servers:
Accepts the following message:
A package was manifested for a work unit: the shipped fact returns v1 authorizes against.
type = com.warehouse.wes.fulfillment-execution.package.PackageManifested,
source /warehouse/fulfillment-execution, dataschema
urn:warehouse:fulfillment-execution:events:PackageManifested:v1.
Subject and Kafka key = the package id. order_ref is the WES work
unit id {order_id}-line-{line_no}; this service reverses it into
(order_id, line_no) to build its manifested_work_units copy.
This service reads package_id, order_ref and the CloudEvents
time (the manifest instant). Restated from fulfillment-execution's
contract, never imported.
Package pkg-1029 manifested for work unit ord-7c9e2f1a-line-1.
{
"specversion": "1.0",
"id": "0b2c4d5e-8f9a-4c0d-9e1f-2a3b4c5d6e7f",
"source": "/warehouse/fulfillment-execution",
"type": "com.warehouse.wes.fulfillment-execution.package.PackageManifested",
"subject": "pkg-1029",
"time": "2026-10-20T11:20:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:warehouse:fulfillment-execution:events:PackageManifested:v1",
"data": {
"package_id": "pkg-1029",
"order_ref": "ord-7c9e2f1a-line-1"
}
}
An RMA was opened for a shipped order line inside the return window.
type = com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorized;
subject and key = the rmaId. window_ends_at is the policy window's
end (authorized_at + return window days); the goods must arrive before
it. quantity is capped by DispositionPolicy.max_units_per_line
(the shipped-quantity check is planned, ADR 0003).
An RMA request was refused: the line never shipped, the window closed or another RMA is open.
type = com.warehouse.wms.returns-processing.returnauthorization.ReturnAuthorizationRejected;
subject and key = the rmaId. rejection_code is LINE_NOT_MANIFESTED,
RETURN_WINDOW_EXPIRED, OPEN_RMA_EXISTS or
QUANTITY_EXCEEDS_POLICY. Not raised today: the domain, the
outbox payload mapping and the encoder support it, but no use case
calls the rejecting transition; POST /returns answers a refusal
with 409 and persists and publishes nothing. Declared for the day a
RejectReturn use case exists.
Returned goods arrived; each line matches an RMA line or is explicitly unexpected.
type = com.warehouse.wms.returns-processing.returnreceipt.ReturnReceiptOpened;
subject and key = the receiptId. rma_id is null when the whole
parcel was unexpected. Every line carries its own nullable rma_id: a
non-null value is a matched line, null means the line is UNEXPECTED
(there is no silent third state). UNEXPECTED lines additionally raise
UnexpectedReturnReceived for exception-management.
A receipt line was graded A, B, C or SCRAP with its reason codes.
type = com.warehouse.wms.returns-processing.returnreceipt.ReturnLineInspected;
subject and key = the receiptId. quantity is the inspected quantity,
never more than the received quantity of the line; a line is inspected
exactly once. The disposition is decided in the same transaction and
raises its own DispositionDecided.
A received line has no matching RMA; exception-management opens a case.
type = com.warehouse.wms.returns-processing.returnreceipt.UnexpectedReturnReceived;
subject and key = the receiptId. Raised per UNEXPECTED receipt line
(the receipt-level fact is ReturnReceiptOpened).
The policy outcome for one inspected line: RESTOCK, REFURBISH, LIQUIDATE, DISPOSE or RTV.
type = com.warehouse.wms.returns-processing.disposition.DispositionDecided;
subject and key = the dispositionId. The decision is the pure function
Decide(grade, classification, policy) and records the
policy_version it used. An operator override is a NEW Disposition
whose supersedes names the original and whose reason is mandatory;
both fields are null on a policy decision.
A RESTOCK disposition hands the goods to inventory-storage as a staged receipt line.
type = com.warehouse.wms.returns-processing.disposition.ReturnLineStaged;
subject and key = the dispositionId. data is inbound-receiving's
ReceiptLineReceived shape (receipt_id, line_no, sku,
quantity, condition, received_at) plus rma_id (null for an
UNEXPECTED line), disposition_id and site_id; inventory-storage
consumes it into its staged-receipt use case and the stow stays an RF
action there. Raised
exactly once per RESTOCK disposition (idempotent on disposition_id);
no other outcome touches any sibling.
The analytics-stream twin of ReturnAuthorized (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnAuthorized:v1. Consumed only by cmd/returns-projector, which ignores it (no report answers the authorization funnel today).
The analytics-stream twin of ReturnAuthorizationRejected (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnAuthorizationRejected:v1. Consumed only by cmd/returns-projector, which ignores it.
The analytics-stream twin of ReturnReceiptOpened (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnReceiptOpened:v1. The projector folds every carried line into its return_line_facts (the opened milestone).
The analytics-stream twin of ReturnLineInspected (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnLineInspected:v1. The projector records the inspected milestone of the receipt line.
The analytics-stream twin of UnexpectedReturnReceived (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:UnexpectedReturnReceived:v1. The projector opens a return-line fact for the unexpected line (the opened milestone).
The analytics-stream twin of DispositionDecided (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:DispositionDecided:v1. The projector records one disposition_facts row (the disposition-mix report's cell) and the decided milestone of the receipt line.
The analytics-stream twin of ReturnLineStaged (ADR 0007).
Same type, id, subject, key and payload as the integration message; dataschema = urn:warehouse:returns-processing:analytics:ReturnLineStaged:v1. The projector records the staged milestone (the value-recovery and return-cycle-time reports' basis).
The handling classification of a SKU, with a monotonically increasing version.
type = com.warehouse.wms.product-master.product.ProductClassified,
source /warehouse/product-master, dataschema
urn:warehouse:product-master:events:ProductClassified:v1. Subject and
Kafka key = the SKU. handling_tags can carry Hazmat and
TemperatureSensitive; dot_hazard_class is 0 when the SKU carries
no rating; classification_source is native or imported. Apply
only when version is greater than the stored one for the SKU. This
service reads sku, handling_tags, temperature_class,
dot_hazard_class and version and ignores classification_source;
handling_tags are stored verbatim (a dot:<n> tag is appended for a
non-zero dot_hazard_class). Restated from product-master's contract,
never imported.
Every line of an order was allocated; the lines carry no quantity.
type = com.warehouse.wes.order-management.order.OrderAllocated,
source /warehouse/order-management, dataschema
urn:warehouse:order-management:events:OrderAllocated:v1. Subject and
Kafka key = the order id. The lines carry line_no, sku, path_id,
gift_wrap and fulfillment_class but NO quantity; this service
reads only order_id and each line's line_no and sku. Restated
from order-management's contract, never imported.
Some lines of an order were allocated; the same line shape as OrderAllocated.
type = com.warehouse.wes.order-management.order.OrderPartiallyAllocated,
source /warehouse/order-management, dataschema
urn:warehouse:order-management:events:OrderPartiallyAllocated:v1.
Subject and Kafka key = the order id. lines holds ONLY the allocated
lines, in the same shape as OrderAllocated (no quantity). Restated
from order-management's contract, never imported.
A package was manifested for a work unit: the shipped fact returns v1 authorizes against.
type = com.warehouse.wes.fulfillment-execution.package.PackageManifested,
source /warehouse/fulfillment-execution, dataschema
urn:warehouse:fulfillment-execution:events:PackageManifested:v1.
Subject and Kafka key = the package id. order_ref is the WES work
unit id {order_id}-line-{line_no}; this service reverses it into
(order_id, line_no) to build its manifested_work_units copy.
This service reads package_id, order_ref and the CloudEvents
time (the manifest instant). Restated from fulfillment-execution's
contract, never imported.
An allocated order line. There is NO quantity on it.