Skip to main content

Domain Events

As built

Derived from network/model/model.yaml. This context's service is built (IQVO/customer-returns, decided by ADR 0012); the model carries its as-built contracts, and identifiers (Err... names, routes, CloudEvents types) are the names the service uses. Where the model left a choice open, the service's own ADRs 0001 to 0005 record what it does.

Every event this context publishes (contexts[customer-returns].publishes) and consumes (.consumes), with the envelope rules of conventions.cloudevents (event standard, ADR 0007).

Envelope​

AttributeValue
specversion1.0
ida UUID minted once when the event is written to the outbox
source/retailnetwork/customer-returns
typecom.retailnetwork.commerce.customer-returns.<entity>.<EventName> (tier commerce; the single entity returnauthorization)
subjectthe aggregate root id, the authorizationId
timethe instant the fact became true
datacontenttypeapplication/json
dataschemaurn:retailnetwork:customer-returns:events:<EventName>:v<version>, where the version is the aggregate version after the change: v1 for ReturnAuthorized, v2 or higher for later events of the same authorization (policy OutboxVersionedSchema)
Kafka topicretailnetwork.customer-returns.events
Kafka keythe subject

Quantities are eaches. Every optional field that does not apply is omitted, never defaulted. No event carries a unit price, an address, a name, a phone number or free text.

Published​

EventCloudEvents typeConsumers
ReturnAuthorizedcom.retailnetwork.commerce.customer-returns.returnauthorization.ReturnAuthorizedvendor-connectivity
ReturnLabelIssuedcom.retailnetwork.commerce.customer-returns.returnauthorization.ReturnLabelIssuedvendor-connectivity
ReturnCompletedcom.retailnetwork.commerce.customer-returns.returnauthorization.ReturnCompletedoffer-availability
ReturnCancelledcom.retailnetwork.commerce.customer-returns.returnauthorization.ReturnCancelledvendor-connectivity

vendor-connectivity consumes ReturnAuthorized, ReturnLabelIssued and ReturnCancelled into its return advices (ReturnAdviceView, its ADR 0014); the consumer is in its develop contract.

Payloads​

EventFields (from the model)
ReturnAuthorizedauthorizationId, orderId, groupNo, reason, disposition, method, lines (lineNo, catalogItemId, quantity, ownerRef (optional)), destinationNodeId (optional, omitted for KEEP), originNodeId (optional), pickupWindowStart and pickupWindowEnd (optional, PICKUP only), expiresAt, authorizedAt
ReturnLabelIssuedauthorizationId, trackingNumber, destinationNodeId, issuedAt
ReturnCompletedauthorizationId, outcome, nodeId, lines (catalogItemId, ownerRef (optional), qtyRestockable, qtyUnsellable), receivedAt
ReturnCancelledauthorizationId, reason, cancelledAt

Value sets: reason of an authorization is DEFECTIVE, NOT_AS_DESCRIBED, WRONG_ITEM, NOT_NEEDED or OTHER; disposition is KEEP, NEAREST_RETURNS_CENTER or ORIGIN_NODE; method is DROP_OFF or PICKUP; outcome is RECEIVED; reason of a cancellation is SHOPPER_REQUESTED or EXPIRED. ReturnAuthorized is raised for every disposition, KEEP included. ReturnCompleted carries the authorized lines only; lines beyond the authorization are never published.

Example envelope​

ReturnCompleted is the restock fact offer-availability applies. The values are illustrative.

{
"specversion": "1.0",
"id": "5d2c9a10-7b3e-4f61-9c0a-2e8b6d4f1a77",
"source": "/retailnetwork/customer-returns",
"type": "com.retailnetwork.commerce.customer-returns.returnauthorization.ReturnCompleted",
"subject": "ret-0f3a91e2",
"time": "2026-11-20T15:30:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:customer-returns:events:ReturnCompleted:v3",
"data": {
"authorizationId": "ret-0f3a91e2",
"outcome": "RECEIVED",
"nodeId": "node-rc-1",
"lines": [
{"catalogItemId": "sku-100", "ownerRef": "sel-42", "qtyRestockable": 1, "qtyUnsellable": 1}
],
"receivedAt": "2026-11-20T15:30:00Z"
}
}

Consumed​

Every consumer dispatches on the full type string and is idempotent on the CloudEvents id (processed_events inbox).

ProducerFull typeWhat this context does
customer-orderingcom.retailnetwork.commerce.customer-ordering.customerorder.CustomerOrderPlacedWrites one OrderGroupView row per group with status PROMISED, the destination postal prefix, the witness node and the placed lines. Never demotes a status a notice already set.
customer-orderingcom.retailnetwork.commerce.customer-ordering.order.ShopperNoticeDecidedFor the families GROUP_SHIPPED, GROUP_DELIVERED, GROUP_LOST and GROUP_RETURNED sets the group status (the status of the fact wins over the family). Other families are ignored.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeRegisteredCreates the node in ReturnsNetworkView. Only RETURNS_CENTER nodes ever influence a disposition.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeActivatedAn ACTIVE returns centre becomes a candidate destination.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeSuspendedThe returns centre stops being a candidate at once.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeRetiredThe node is never a destination again.
node-topologycom.retailnetwork.logistics.node-topology.servicearea.ServiceAreaAssignedStores which region a postal prefix belongs to; the highest assignmentVersion wins.
order-sourcingcom.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReleasedToNodeStores the per-item ownerRef of the release on the group's origin row.
order-sourcingcom.retailnetwork.commerce.order-sourcing.assignment.FulfillmentLockedStores the fulfilling node: the ORIGIN_NODE fallback.
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.returnoutcome.VendorReturnOutcomeSubmittedCompletes the first open authorization the graded outcome fits (RECEIVED, ReturnCompleted with the authorized lines only); every outcome is recorded on ReturnOutcomeFacts, lines beyond the authorization flagged unexpected.

As built (service ADR 0003): one consumer per producer topic, each under a mandatory group variable (ORDER_CONSUMER_GROUP, TOPOLOGY_CONSUMER_GROUP, SOURCING_CONSUMER_GROUP, VENDOR_CONSUMER_GROUP). A transient failure is retried with capped backoff; a payload that can never apply is dead-lettered to <topic>.dlq. A type the context does not act on is committed past.

The fourth consumer reads retailnetwork.vendor-connectivity.events for the vendor's graded outcome, VendorReturnOutcomeSubmitted, the last row of the table: vendor-connectivity publishes it since its ADR 0014 shipped, and the model has a consumes row for it.