Skip to main content

Domain Events

As built

Derived from network/model/model.yaml. This context's service is built; the model carries its as-built contracts, and identifiers (Err... names, routes, CloudEvents types) are the names the service uses.

Every event this context publishes (contexts[node-performance].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; a redelivery carries the same id
source/retailnetwork/node-performance
typecom.retailnetwork.partner.node-performance.scorecard.<EventName> (tier partner, entity scorecard for every event)
subjectthe aggregate root id, scorecardId = nodeId + ':' + window (for example N-0042:30d)
timethe instant the recompute ran (computedAt for NodeScorecardUpdated)
datacontenttypeapplication/json
dataschemaurn:retailnetwork:node-performance:events:<EventName>:v1
Kafka topicretailnetwork.node-performance.events
Kafka keythe scorecardId, same as subject

Published​

NodeScorecardUpdated​

Typecom.retailnetwork.partner.node-performance.scorecard.NodeScorecardUpdated
Topicretailnetwork.node-performance.events
Subject / keyscorecardId (nodeId:window)
Produced byRecompute use case, after the scorecard is saved (outbox row in the same transaction)
Consumersdelivery-promise (ScorecardView, ScorecardHandicap), order-sourcing (ScorecardView, AssignmentCost)
FieldTypeMeaning
nodeIdstringThe node, as minted by node-topology.
windowstring7d or 30d (literal proposed; the model says "7-day and 30-day").
gradestringA, B, C, D, or PROVISIONAL below the observation minimum (the ul definition of Grade).
onTimeHandoverRatenumber in [0,1]Share of packages handed over before requiredShipBy.
lateAckRatenumber in [0,1]Share of purchase orders acknowledged in the last 10% of the window or expired.
rejectRatenumber in [0,1]From PurchaseOrderRejected observations.
expiryRatenumber in [0,1]From PurchaseOrderExpired observations.
promiseKeptRatenumber in [0,1]From PromiseKept and PromiseBroken observations.
feedFreshnessP95Minutesnumber, minutesp95 feed freshness from InventoryFeedApplied observations.
observationsintegerObservations counted in the window.
computedAtRFC 3339 instantWhen the recompute ran.

NodeThresholdBreached​

Typecom.retailnetwork.partner.node-performance.scorecard.NodeThresholdBreached
Topicretailnetwork.node-performance.events
Subject / keyscorecardId
Produced byRecompute use case, ThresholdAlert policy, one event per metric that crossed its threshold downward in this recompute
Consumersanalytics only (no in-organization consumer)
FieldTypeMeaning
nodeIdstringThe node.
metricstringThe Metrics field name that crossed, for example onTimeHandoverRate.
valuenumberThe metric's new value.
thresholdnumberThe threshold it crossed.
windowstring7d or 30d.

The model does not say whether an "analytics only" event goes to the .events topic or to retailnetwork.node-performance.analytics (conventions.cloudevents.analytics_topic). These pages put both published events on .events, because both are in publishes; this is listed as an open question.

NodeTierEligibilityChanged​

Typecom.retailnetwork.partner.node-performance.scorecard.NodeTierEligibilityChanged
Topicretailnetwork.node-performance.events (an integration event, not analytics-only)
Subject / keythe 7d scorecardId (nodeId:7d)
Produced byRecompute of the 7d scorecard, policy FastTierEligibility, only when the node's eligibility flag flips: one event per tier, with the same changedAt, in the same transaction as the scorecard save
Consumersdelivery-promise (NodeTierEligibility, policy FastTierCandidateFilter)
FieldTypeMeaning
nodeIdstringThe node.
tierenumSAME_DAY or NEXT_DAY, the tiers this context governs.
eligiblebooleanfalse on suspension, true on reinstatement.
metricstringonTimeHandoverRate.
valuenumberThe rate that caused the change.
thresholdnumber0.90 on suspension, 0.95 on reinstatement.
windowstring7d.
changedAttimestampThe instant of the flip, RFC 3339 UTC.

Every node starts eligible and the initial state publishes nothing, so a consumer that has never seen an event treats the node as eligible. Delivery is at least once: the state a consumer holds is the eligible of the latest event per nodeId and tier.

Example envelope​

The most important event is NodeScorecardUpdated: it is the only output other contexts act on.

{
"specversion": "1.0",
"id": "7d0c6a52-3f7e-4b8e-9a51-2a8f0c1d9e44",
"source": "/retailnetwork/node-performance",
"type": "com.retailnetwork.partner.node-performance.scorecard.NodeScorecardUpdated",
"subject": "N-0042:30d",
"time": "2026-10-22T14:03:00Z",
"datacontenttype": "application/json",
"dataschema": "urn:retailnetwork:node-performance:events:NodeScorecardUpdated:v1",
"data": {
"nodeId": "N-0042",
"window": "30d",
"grade": "B",
"onTimeHandoverRate": 0.962,
"lateAckRate": 0.021,
"rejectRate": 0.012,
"expiryRate": 0.004,
"promiseKeptRate": 0.951,
"feedFreshnessP95Minutes": 38,
"observations": 1874,
"computedAt": "2026-10-22T14:03:00Z"
}
}

The values are illustrative. Grade B: on-time 0.962 >= 0.95, promise-kept 0.951 >= 0.94, late ack 0.021 <= 0.03, and on-time below the A bar of 0.98.

Consumed​

Every consumer dispatches on the full type string and is idempotent on the CloudEvents id: the processed_events inbox row and the aggregate change commit in one transaction. A duplicate id is acknowledged and skipped. If the inbox misses (for example the same fact re-emitted with a new id, which the producers' outboxes rule out), the aggregate's ErrDuplicateObservation stops a second count of the same source event.

ProducerFull typeFields usedWhat this context does
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.vendoraccount.VendorOnboardednoneNothing the model specifies. The payload (vendorId, name, ackWindowMinutes) has no nodeId; the inbox records it. Open question.
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderIssuedpoNumber, nodeId, requiredShipBy, ackBy; envelope time as the issue instantRecordObservation: a PO was asked of the node. Denominator of the PO rates; source of requiredShipBy for later handovers (PurchaseOrderFacts: a field is only ever filled, never erased, so the first requiredShipBy stored wins, ADR 0003 item 3).
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderAcceptedpoNumber, nodeId, acceptedAtRecordObservation: an acknowledgement. Late if acceptedAt falls in the last 10% of the ack window.
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderRejectedpoNumber, nodeId, reasonCode, rejectedAtRecordObservation: a rejection (reject rate) and an acknowledgement (late-ack check).
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderExpiredpoNumber, nodeId, ackByRecordObservation: an expiry (expiry rate; always late for the Late Ack Rate).
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.purchaseorder.VendorShipmentConfirmedpoNumber, nodeId, trackingNumbers, requiredShipByRecordObservation: links tracking numbers to the PO's requiredShipBy. shippedAt is the vendor's own statement and is not used for on-time; the handover is.
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.submission.SubmissionProcessednoneNothing the model specifies. The payload (transactionId, vendorId, kind, status, errorCount) has no nodeId, so it cannot reach a node scorecard. Open question.
shipping-and-trackingcom.retailnetwork.logistics.shipping-and-tracking.journey.PackageHandedOvertrackingNumber, poNumber, nodeId, handedOverAtRecordObservation: on time if handedOverAt is before the PO's requiredShipBy.
delivery-promisecom.retailnetwork.commerce.delivery-promise.promise.PromiseKeptpromiseId, nodeId, deliveredAt, deliverByLatestRecordObservation: a kept promise for the node.
delivery-promisecom.retailnetwork.commerce.delivery-promise.promise.PromiseBrokenpromiseId, nodeId, lateByMinutes, causeRecordObservation: a broken promise for the node. Which cause values count against the node is open.
offer-availabilitycom.retailnetwork.commerce.offer-availability.inventoryfeed.InventoryFeedAppliedfeedId, nodeId, appliedAtRecordObservation: a feed instant for the freshness metric. The sampling rule is open.
vendor-connectivitycom.retailnetwork.partner.vendor-connectivity.inboundreceipt.InboundReceiptSubmittednodeId, shipmentId, receivedAt, cartons[].statusRecordObservation (informational, proposed in ADR 0009): timeliness is receivedAt minus the shipment's shippedAt (kept from InboundShipmentShipped), accuracy is the share of reported cartons with status RECEIVED. Never graded, and not on NodeScorecardUpdated.
seller-inboundcom.retailnetwork.partner.seller-inbound.inboundshipment.InboundShipmentShippedshipmentId, nodeId, shippedAtRecordObservation (informational): stores the shipment's shipped instant for the timeliness metric.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeRegisterednoneNothing the model specifies; the inbox records it. A node's scorecards are created by its first observation. Open question.
node-topologycom.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclarednoneNothing the model specifies. It is the declared side of Declared vs Measured, and by decision it never enters a metric; no read model holds it. Open question.

Partition order: each producer keys by its own aggregate root id (poNumber, trackingNumber, promiseId, feedId, nodeId), so facts about one node arrive on many partitions in no global order. The scorecard does not depend on arrival order: a handover that arrives before its PurchaseOrderIssued or VendorShipmentConfirmed is kept and counted when Recompute finds its requiredShipBy.