Skip to main content

ADR 0003: consumed contracts, local read models, synchronous calls and relationships

Status​

Accepted (2026-10-23).

Context​

vendor-connectivity is the retail network's Open Host Service for vendors (model roles: Gateway / Open Host Service, Execution). It is fed by three producers, serves the Vendor API to one downstream (the warehouse-systems fleet's network-fulfillment, Conformist + Anti-Corruption Layer) and makes four in-organization calls the model lists under sync_calls. contracts-delta.md E2 and E4 and Gap Register items G2, G4, G12 and G32 shape the seam.

Decision​

Relationships​

NeighbourDirectionPatternContract
network-fulfillment (fleet vendor V-WS)calls usOpen Host Service + Published Language; downstream is Conformist + ACLapis/openapi.yaml. No Kafka topic is shared, in either direction.
order-sourcingKafka in, Kafka outCustomer/Supplierin: FulfillmentReleasedToNode, FulfillmentCancelled, FulfillmentReleaseWithdrawn (ADR 0013); out: PurchaseOrderAccepted, Rejected, Expired, VendorShipmentConfirmed
node-topologyKafka in, REST outConformistin: NodeRegistered, NodeOperationalProfileDeclared, NodeActivated, NodeSuspended, NodeRetired; out: POST /nodes, PUT /nodes/{nodeId}/operational-profile
offer-availabilityKafka in, REST outConformistin: ListingCreated; out: POST /inventory-feeds
shipping-and-trackingREST outCustomerPOST /labels (IssueLabel)
node-performanceREST outCustomerGET /scorecards/{nodeId} (GetScorecard)

Consumed events (all on .events, dispatched on the FULL type, tolerant decoding)​

TypeFields relied onEffect
com.retailnetwork.logistics.node-topology.node.NodeRegisterednodeId, nodeType, subtype?, operator, vendorId?, vendorNodeCode?, regionId, timezoneupsert VendorNodeView (A13)
...node-topology.node.NodeOperationalProfileDeclarednodeId, profileRevision, handlingTimeMinutesVendorNodeView.handlingTimeMinutes for ackBy (E4, G4); a lower revision never overwrites a higher one
...node-topology.node.NodeActivated / NodeSuspended / NodeRetirednodeIdVendorNodeView.status
com.retailnetwork.commerce.offer-availability.listing.ListingCreatedlistingId, catalogItemId?, nodeIdupsert ListingView (A12)
com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReleasedToNodeassignmentId, releaseNo, orderId, groupNo?, nodeId, requiredShipBy, tier, lines[{listingId, quantity, ownerRef?}] (ownerRef absent = operator-owned, ADR 0012)policy IssueOnRelease -> PurchaseOrderIssued (A1, A3, A4)
...order-sourcing.assignment.FulfillmentCancelledassignmentId, orderId?, groupNo?, reason?policy CancelOnSourcingCancel (A15, A16)
...order-sourcing.assignment.FulfillmentReleaseWithdrawnassignmentId (the carrier), releaseNo, reason?; orderId, groupNo, withdrawnAt not relied onpolicy CancelOnReleaseWithdrawn (ADR 0013): cancels the ISSUED order of exactly that release

Consumer rules: one mandatory consumer group VENDOR_CONNECTIVITY_CONSUMER_GROUP; the inbox table processed_events keyed by the CloudEvents id, written in the same transaction as the effect; a message that is not CloudEvents 1.0, has an unknown type or a malformed payload is skipped past (committed) and counted; a transient failure is retried with capped backoff and then published to <topic>.dlq with x-dlq-* headers. The node-topology event for a node that is not yet known is the only domain-level retry (A4). orderId and tier from the release are stored on the purchase order and never leave the service except in the IssueLabel call (E2, G2); groupNo is stored for diagnostics.

Local read models​

  • VendorNodeView (network.Node, table vendor_nodes): nodeId, operator, vendorId, vendorNodeCode, nodeType, subtype, regionId, timezone, status, handlingTimeMinutes, profileRevision. It answers ownership (ErrNodeNotOwnedByVendor), GET /vendor/nodes and GET /vendor/nodes/{nodeId}, and the handling time of ackBy.
  • ListingView (network.Listing, table listings): listingId, nodeId, catalogItemId.

Neither is exposed except through the Vendor API's own schemas.

Synchronous in-organization calls (model sync_calls; nothing else is called)​

Use caseNeighbour routeWhen
RegisterNodenode-topology POST /nodes (operator VENDOR, vendorRef{vendorId, vendorNodeCode})ProcessSubmission of NODE_REGISTRATION
DeclareOperationalProfilenode-topology PUT /nodes/{nodeId}/operational-profile (declaredBy VENDOR)ProcessSubmission of NODE_PROFILE
ApplyInventoryFeedoffer-availability POST /inventory-feeds (feedId = transactionId)ProcessSubmission of INVENTORY
IssueLabelshipping-and-tracking POST /labels ({poNumber, packageNo, assignmentId, orderId, tier})inside POST /vendor/shipping-labels (the one synchronous write, G31)
GetScorecardnode-performance GET /scorecards/{nodeId}inside GET /vendor/nodes/{nodeId}/scorecard

Every call carries an Idempotency-Key (the transaction id, or vc-label-<poNumber>-<packageNo>), a per-call timeout and a bounded HTTP client; the neighbour's application/problem+json type becomes the Err... code of a failed submission (A2, A10). The adapters live in internal/adapters/outbound/<neighbour> behind ports in internal/application/ports; the fleet and the neighbours are never imported.

Outbox, publishing and the Vendor API facts​

  • Every command that raises an event writes the aggregate row(s) and one outbox_events row per event, the CloudEvents envelope already encoded and its id minted once, in ONE Postgres transaction (ADR 0002, A27). The relay is always on; the attempt cap is OUTBOX_MAX_ATTEMPTS (default 20).
  • idempotency_keys(route, key) with a 24 hour TTL replays the first response of every state-changing POST/PUT; the key is per route (model conventions).
  • Vendor identity under no authentication (G32): vendorId in every write body and as a required query parameter on reads. This is a consistency check, not security. The Vendor API carries no ship-to PII, no delivery promise and no push.

Consequences​

  • The hot paths (poll, acknowledge, label) read local tables; only the label and scorecard reads call a neighbour in-request.
  • A neighbour that is down delays a transaction (it stays PROCESSING) instead of losing it.

Amended by ADR 0005: two more consumed producers (seller-inbound, offer-availability packaging events) and two more local read models.

Addendum 2026-11-18: replay classes​

The replay of refusals is now decided by ADR 0015: a 2xx and a FINAL or OUTCOME refusal are stored and replayed, a RETRYABLE refusal and a 5xx are not and release the key. The text above is the decision as it was taken.

Addendum 2026-11-19: refusals the callees release​

"A neighbour that is down delays a transaction (it stays PROCESSING)" now also holds for a refusal the callee releases under the Idempotency-Key (replay class RETRYABLE): ADR 0016 keeps such a submission pending and retries it under the same key within the existing attempt budget. The text above is the decision as it was taken.