Bounded Context Canvas
Following the ddd-crew Bounded Context Canvas v5. Every message row is checked against the router, the five consumers, the outbox encoder and the four neighbour clients in the code.
Canvas at a glance
Two pictures of the sections below. Arrows follow the message type:
solid blue commands (cmd), dotted green queries (qry), thick
orange events (evt). Box shapes mark the collaborator kind: rounded =
people; blue = sibling bounded context; double border = external system
(the other organization); dashed = no context consumer. Channel names are
abbreviated; the tables carry the exact route, topic and CloudEvents type.
Inbound
Source: internal/adapters/inbound/kafka/consumers.go and inbound_consumers.go (consumed), internal/adapters/outbound/kafka/encoder.go (published), internal/adapters/outbound/httpclient/clients.go (synchronous calls), internal/adapters/inbound/http/server.go and apis/openapi.yaml (Vendor API).
Outbound
Source: internal/adapters/inbound/kafka/consumers.go and inbound_consumers.go (consumed), internal/adapters/outbound/kafka/encoder.go (published), internal/adapters/outbound/httpclient/clients.go (synchronous calls), internal/adapters/inbound/http/server.go and apis/openapi.yaml (Vendor API).
Omitted: the internal triggers that drive commands without a collaborator
(the ExpireUnacknowledged sweep and the submission processor that runs
ProcessSubmission after notBefore, and the retention sweeper); replies to queries; the
relationship pattern per message (see the tables); VendorSuspended and VendorReinstated, which
have no consumer yet. "Accepted, Rejected, Expired" on the arrows abbreviate the full
PurchaseOrder... event names.
Name
Vendor Connectivity (vendor-connectivity, code VC, CloudEvents tier
partner).
Purpose
The network's Open Host Service for vendors that operate fulfillment nodes. It publishes the Vendor API and its Published Language: vendors register nodes, declare their operational profile, send inventory feeds, poll purchase orders, acknowledge them in full inside the acknowledgement window, request labels and confirm shipment. Every write is an asynchronous transaction a vendor reconciles.
Strategic Classification
| Axis | Verdict |
|---|---|
| Domain | Supporting. See the Core Domain Chart. |
| Business Model | Revenue-channel enabler (third-party capacity without integration cost). |
| Evolution | Product: the protocol shape is well known and adopted in the network's own vocabulary. |
Domain Roles
| Role | Applies? | Why |
|---|---|---|
| Gateway / Open Host Service | Yes, primary | The Vendor API is the one door for every vendor; its schemas are the Published Language (apis/openapi.yaml). It relays node, profile and inventory writes to their owners. |
| Execution | Yes | Owns the purchase-order protocol and its clock: issue, ackBy, expiry, acceptance, label gate, shipment confirmation. |
| Analysis | No | Measuring vendors is node-performance's job. |
| Specification | No | Node and listing master data belong to node-topology and offer-availability. |
Inbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
network-fulfillment (warehouse-systems, vendor V-WS) | RegisterVendorNode | Command | Vendor API POST /vendor/nodes | OHS + PL (downstream is Conformist + ACL) |
| network-fulfillment | DeclareNodeProfile | Command | Vendor API PUT /vendor/nodes/{nodeId}/profile | OHS + PL (downstream is Conformist + ACL) |
| network-fulfillment | SubmitInventory | Command | Vendor API POST /vendor/inventory | OHS + PL (downstream is Conformist + ACL) |
| network-fulfillment | SubmitAcknowledgement | Command | Vendor API POST /vendor/acknowledgements | OHS + PL (downstream is Conformist + ACL) |
| network-fulfillment | RequestLabel | Command | Vendor API POST /vendor/shipping-labels | OHS + PL (downstream is Conformist + ACL) |
| network-fulfillment | SubmitShipmentConfirmation | Command | Vendor API POST /vendor/shipment-confirmations | OHS + PL (downstream is Conformist + ACL) |
| network-fulfillment | PollPurchaseOrders | Query | Vendor API GET /vendor/purchase-orders?createdAfter=&nodeId=&cursor= | OHS + PL |
| network-fulfillment | GetPurchaseOrder | Query | Vendor API GET /vendor/purchase-orders/{poNumber} | OHS + PL |
| network-fulfillment | GetTransaction | Query | Vendor API GET /vendor/transactions/{transactionId} | OHS + PL |
| network-fulfillment | GetNode, ListVendorNodes | Query | Vendor API GET /vendor/nodes/{nodeId}, GET /vendor/nodes | OHS + PL |
| network-fulfillment | GetScorecard | Query | Vendor API GET /vendor/nodes/{nodeId}/scorecard | OHS + PL |
| network-fulfillment | PollInboundShipments, GetInboundShipment | Query | Vendor API GET /vendor/inbound-shipments, GET /vendor/inbound-shipments/{shipmentId} | OHS + PL |
| network-fulfillment | SubmitInboundReceipt | Command | Vendor API POST /vendor/inbound-receipts | OHS + PL (downstream is Conformist + ACL) |
| Network partner managers (human) | OnboardVendor, SuspendVendor, ReinstateVendor, GetVendor | Command, Query | REST POST /vendors, POST /vendors/{vendorId}/suspensions, POST /vendors/{vendorId}/reinstatements, GET /vendors/{vendorId} | UI |
| order-sourcing | FulfillmentReleasedToNode | Event | Kafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReleasedToNode | Customer/Supplier |
| order-sourcing | FulfillmentCancelled | Event | Kafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentCancelled | Customer/Supplier |
| node-topology | NodeRegistered | Event | Kafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRegistered | Conformist |
| node-topology | NodeOperationalProfileDeclared | Event | Kafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclared | Conformist |
| node-topology | NodeActivated | Event | Kafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeActivated | Conformist |
| node-topology | NodeSuspended | Event | Kafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeSuspended | Conformist |
| node-topology | NodeRetired | Event | Kafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRetired | Conformist |
| offer-availability | ListingCreated | Event | Kafka retailnetwork.offer-availability.events, com.retailnetwork.commerce.offer-availability.listing.ListingCreated | Conformist |
| offer-availability | CatalogItemPackagingDeclared, CatalogItemPackLevelRetired | Event | Kafka retailnetwork.offer-availability.events, com.retailnetwork.partner.offer-availability.catalogitem.CatalogItemPackagingDeclared and ...CatalogItemPackLevelRetired (the commerce tier spelling is accepted too) | Conformist |
| seller-inbound | InboundShipmentLabelled, InboundShipmentShipped, InboundShipmentReceived | Event | Kafka retailnetwork.seller-inbound.events, com.retailnetwork.partner.seller-inbound.inboundshipment.<Event> | Conformist |
Outbound Communication
| Collaborator | Message | Type | Channel | Relationship |
|---|---|---|---|---|
| node-performance | VendorOnboarded | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.vendoraccount.VendorOnboarded | Conformist (downstream) |
| node-performance | PurchaseOrderIssued | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderIssued | Conformist (downstream) |
| order-sourcing, node-performance | PurchaseOrderAccepted | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderAccepted | Customer/Supplier (order-sourcing); Conformist (node-performance) |
| order-sourcing, node-performance | PurchaseOrderRejected | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderRejected | Customer/Supplier (order-sourcing); Conformist (node-performance) |
| order-sourcing, node-performance | PurchaseOrderExpired | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderExpired | Customer/Supplier (order-sourcing); Conformist (node-performance) |
| analytics only | PurchaseOrderCancelled | Event | Kafka retailnetwork.vendor-connectivity.analytics (not the events topic), com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderCancelled | — (no context consumer) |
| order-sourcing, shipping-and-tracking, node-performance | VendorShipmentConfirmed | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.VendorShipmentConfirmed | Customer/Supplier (order-sourcing, shipping-and-tracking); Conformist (node-performance) |
| none yet | VendorSuspended, VendorReinstated | Event | Kafka retailnetwork.vendor-connectivity.events | — (no context consumer) |
| node-performance | SubmissionProcessed | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.submission.SubmissionProcessed | Conformist (downstream) |
| seller-inbound, node-performance | InboundReceiptSubmitted | Event | Kafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.inboundreceipt.InboundReceiptSubmitted | Customer/Supplier (seller-inbound); Conformist (node-performance) |
| node-topology | RegisterNode, DeclareOperationalProfile | Command | REST (in-org) POST /nodes, PUT /nodes/{nodeId}/operational-profile | Customer/Supplier (this context is the Customer) |
| offer-availability | ApplyInventoryFeed | Command | REST (in-org) POST /inventory-feeds | Customer/Supplier (this context is the Customer) |
| shipping-and-tracking | IssueLabel | Command | REST (in-org) POST /labels | Customer/Supplier (this context is the Customer) |
| node-performance | GetScorecard | Query | REST (in-org) GET /scorecards/{nodeId} | Customer/Supplier (this context is the Customer) |
Full payloads: Domain Events. Patterns and reasons: Context Map.
Ubiquitous Language
Full glossary with the fleet translation:
Ubiquitous Language.
Top terms: Vendor, Purchase Order (poNumber), Acknowledgement
(fill-or-kill), ackBy, Required Ship-By, Submission /
Transaction (transactionId), Label (never the address), Vendor
API.
Business Decisions
- Acknowledge once, in full, before
ackBy. Fill-or-kill; partial acknowledgements are refused (ErrPartialAcknowledgement,ErrAlreadyAcknowledged,ErrAckWindowClosed). ackBy = min(issuedAt + vendor ackWindow, requiredShipBy - node handlingTime).- A label is issued only for an
ACCEPTEDpurchase order; a shipment is confirmed only after a label (ErrLabelBeforeAcceptance,ErrConfirmWithoutLabel). - Every vendor write returns
202with atransactionId; the write takes effect when its transaction succeeds. - The Vendor API never carries ship-to PII.
- Rate limits are part of the contract (
429withRetry-After). - One release, one purchase order.
poNumberis idempotent onassignmentId + releaseNo(policyIssueOnRelease), so a redelivered release never issues a second order. - Cancel only while
ISSUED(ErrCancelAfterAcknowledgement, policyCancelOnSourcingCancel).
Assumptions
order-sourcingreleases to a vendor node early enough thatackByis in the future (itsVirtualQueuepolicy subtracts a vendor ack budget).- The node's handling time is known to this context when it issues a
purchase order: it arrives with
NodeOperationalProfileDeclared(handlingTimeMinutes) and is kept in the local node view; a node with no profile yet has handling time 0. - Vendors poll often enough to see a purchase order well before
ackBy. - The four simulation knobs default to well-behaved; a non-default value is a test setting, not production behaviour.
- One vendor per node: a node's
vendorIdcomes fromNodeRegistered.
Verification Metrics
The service emits one business instrument, vendor.submissions.processed (see
Observability); the other metrics below are derived from the
events and are not implemented as instruments.
| Metric | Source | Target (judgement) |
|---|---|---|
Share of purchase orders acknowledged before ackBy | PurchaseOrderAccepted + PurchaseOrderRejected vs PurchaseOrderExpired | Expiry rate tracked per node by node-performance (expiryRate) |
| Acknowledgement latency (issue to accepted or rejected) | PurchaseOrderIssued.time to PurchaseOrderAccepted.acceptedAt / PurchaseOrderRejected.rejectedAt | p95 well inside the vendor's ack window |
| Transaction failure share by kind | SubmissionProcessed (kind, status, errorCount) | Equals TX_FAILURE_RATE in simulation; near 0 otherwise |
| Processing lag | processedAt - notBefore per submission | p95 under one processor tick |
429 responses per vendor | API metrics | Low and stable; a spike means a vendor is not honouring Retry-After |
| Shipments confirmed on time | VendorShipmentConfirmed (shippedAt vs requiredShipBy) | Feeds node-performance's on-time handover |
| Ship-to PII in the Vendor API | Contract review of openapi.yaml | Zero fields, always |
Open Questions
Questions the aggregator's model raised, and how the code settled them:
- Where does
ackBygethandlingTime? Settled: fromNodeOperationalProfileDeclared(OnNodeProfileDeclared), stored on the node view. A node with no declared profile has handling time 0, so itsackByis bounded by the vendor window andrequiredShipByalone. - Cancellation after acknowledgement (one race stays open). order-sourcing may cancel a
RELEASEDassignment while its purchase order isACK_PROCESSINGorACCEPTED; here cancel is refused (ErrCancelAfterAcknowledgement), logged at INFO (purchase order not cancelled) and nothing is published. An acceptance that arrives after order-sourcing cancelled aRELEASEDassignment is only logged there, so the vendor may still ship a cancelled group. - Vendor suspension. Settled:
POST /vendors/{vendorId}/suspensionsandPOST /vendors/{vendorId}/reinstatementsexist, raiseVendorSuspendedandVendorReinstated, and a suspended vendor's writes answer409 vendor-suspendedwhile reads stay open. No consumer reads the two events yet. - The label request is synchronous. Settled:
POST /vendor/shipping-labelsreturns200with the labels; it is the one write that does not return202. - How does a vendor learn its
nodeId? Settled: the processedNODE_REGISTRATIONtransaction carries the newnodeId(result_node_id). - Who is calling? Settled:
vendorIdis in every write body and a required query parameter on every read;ErrNodeNotOwnedByVendoris checked on both. It is a consistency check, not security. - Synchronous refusal or failed transaction? Settled: an invariant this context can check at
receipt is refused synchronously (4xx, no transaction); a neighbour's refusal during processing
ends the transaction in
FAILUREwith the neighbour'sErr...code, and a neighbour outage leaves itPROCESSINGfor up to 5 passes.