Skip to main content

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​

AxisVerdict
DomainSupporting. See the Core Domain Chart.
Business ModelRevenue-channel enabler (third-party capacity without integration cost).
EvolutionProduct: the protocol shape is well known and adopted in the network's own vocabulary.

Domain Roles​

RoleApplies?Why
Gateway / Open Host ServiceYes, primaryThe 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.
ExecutionYesOwns the purchase-order protocol and its clock: issue, ackBy, expiry, acceptance, label gate, shipment confirmation.
AnalysisNoMeasuring vendors is node-performance's job.
SpecificationNoNode and listing master data belong to node-topology and offer-availability.

Inbound Communication​

CollaboratorMessageTypeChannelRelationship
network-fulfillment (warehouse-systems, vendor V-WS)RegisterVendorNodeCommandVendor API POST /vendor/nodesOHS + PL (downstream is Conformist + ACL)
network-fulfillmentDeclareNodeProfileCommandVendor API PUT /vendor/nodes/{nodeId}/profileOHS + PL (downstream is Conformist + ACL)
network-fulfillmentSubmitInventoryCommandVendor API POST /vendor/inventoryOHS + PL (downstream is Conformist + ACL)
network-fulfillmentSubmitAcknowledgementCommandVendor API POST /vendor/acknowledgementsOHS + PL (downstream is Conformist + ACL)
network-fulfillmentRequestLabelCommandVendor API POST /vendor/shipping-labelsOHS + PL (downstream is Conformist + ACL)
network-fulfillmentSubmitShipmentConfirmationCommandVendor API POST /vendor/shipment-confirmationsOHS + PL (downstream is Conformist + ACL)
network-fulfillmentPollPurchaseOrdersQueryVendor API GET /vendor/purchase-orders?createdAfter=&nodeId=&cursor=OHS + PL
network-fulfillmentGetPurchaseOrderQueryVendor API GET /vendor/purchase-orders/{poNumber}OHS + PL
network-fulfillmentGetTransactionQueryVendor API GET /vendor/transactions/{transactionId}OHS + PL
network-fulfillmentGetNode, ListVendorNodesQueryVendor API GET /vendor/nodes/{nodeId}, GET /vendor/nodesOHS + PL
network-fulfillmentGetScorecardQueryVendor API GET /vendor/nodes/{nodeId}/scorecardOHS + PL
network-fulfillmentPollInboundShipments, GetInboundShipmentQueryVendor API GET /vendor/inbound-shipments, GET /vendor/inbound-shipments/{shipmentId}OHS + PL
network-fulfillmentSubmitInboundReceiptCommandVendor API POST /vendor/inbound-receiptsOHS + PL (downstream is Conformist + ACL)
Network partner managers (human)OnboardVendor, SuspendVendor, ReinstateVendor, GetVendorCommand, QueryREST POST /vendors, POST /vendors/{vendorId}/suspensions, POST /vendors/{vendorId}/reinstatements, GET /vendors/{vendorId}UI
order-sourcingFulfillmentReleasedToNodeEventKafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentReleasedToNodeCustomer/Supplier
order-sourcingFulfillmentCancelledEventKafka retailnetwork.order-sourcing.events, com.retailnetwork.commerce.order-sourcing.assignment.FulfillmentCancelledCustomer/Supplier
node-topologyNodeRegisteredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRegisteredConformist
node-topologyNodeOperationalProfileDeclaredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeOperationalProfileDeclaredConformist
node-topologyNodeActivatedEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeActivatedConformist
node-topologyNodeSuspendedEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeSuspendedConformist
node-topologyNodeRetiredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRetiredConformist
offer-availabilityListingCreatedEventKafka retailnetwork.offer-availability.events, com.retailnetwork.commerce.offer-availability.listing.ListingCreatedConformist
offer-availabilityCatalogItemPackagingDeclared, CatalogItemPackLevelRetiredEventKafka retailnetwork.offer-availability.events, com.retailnetwork.partner.offer-availability.catalogitem.CatalogItemPackagingDeclared and ...CatalogItemPackLevelRetired (the commerce tier spelling is accepted too)Conformist
seller-inboundInboundShipmentLabelled, InboundShipmentShipped, InboundShipmentReceivedEventKafka retailnetwork.seller-inbound.events, com.retailnetwork.partner.seller-inbound.inboundshipment.<Event>Conformist

Outbound Communication​

CollaboratorMessageTypeChannelRelationship
node-performanceVendorOnboardedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.vendoraccount.VendorOnboardedConformist (downstream)
node-performancePurchaseOrderIssuedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderIssuedConformist (downstream)
order-sourcing, node-performancePurchaseOrderAcceptedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderAcceptedCustomer/Supplier (order-sourcing); Conformist (node-performance)
order-sourcing, node-performancePurchaseOrderRejectedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderRejectedCustomer/Supplier (order-sourcing); Conformist (node-performance)
order-sourcing, node-performancePurchaseOrderExpiredEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderExpiredCustomer/Supplier (order-sourcing); Conformist (node-performance)
analytics onlyPurchaseOrderCancelledEventKafka retailnetwork.vendor-connectivity.analytics (not the events topic), com.retailnetwork.partner.vendor-connectivity.purchaseorder.PurchaseOrderCancelled— (no context consumer)
order-sourcing, shipping-and-tracking, node-performanceVendorShipmentConfirmedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.purchaseorder.VendorShipmentConfirmedCustomer/Supplier (order-sourcing, shipping-and-tracking); Conformist (node-performance)
none yetVendorSuspended, VendorReinstatedEventKafka retailnetwork.vendor-connectivity.events— (no context consumer)
node-performanceSubmissionProcessedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.submission.SubmissionProcessedConformist (downstream)
seller-inbound, node-performanceInboundReceiptSubmittedEventKafka retailnetwork.vendor-connectivity.events, com.retailnetwork.partner.vendor-connectivity.inboundreceipt.InboundReceiptSubmittedCustomer/Supplier (seller-inbound); Conformist (node-performance)
node-topologyRegisterNode, DeclareOperationalProfileCommandREST (in-org) POST /nodes, PUT /nodes/{nodeId}/operational-profileCustomer/Supplier (this context is the Customer)
offer-availabilityApplyInventoryFeedCommandREST (in-org) POST /inventory-feedsCustomer/Supplier (this context is the Customer)
shipping-and-trackingIssueLabelCommandREST (in-org) POST /labelsCustomer/Supplier (this context is the Customer)
node-performanceGetScorecardQueryREST (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​

  1. Acknowledge once, in full, before ackBy. Fill-or-kill; partial acknowledgements are refused (ErrPartialAcknowledgement, ErrAlreadyAcknowledged, ErrAckWindowClosed).
  2. ackBy = min(issuedAt + vendor ackWindow, requiredShipBy - node handlingTime).
  3. A label is issued only for an ACCEPTED purchase order; a shipment is confirmed only after a label (ErrLabelBeforeAcceptance, ErrConfirmWithoutLabel).
  4. Every vendor write returns 202 with a transactionId; the write takes effect when its transaction succeeds.
  5. The Vendor API never carries ship-to PII.
  6. Rate limits are part of the contract (429 with Retry-After).
  7. One release, one purchase order. poNumber is idempotent on assignmentId + releaseNo (policy IssueOnRelease), so a redelivered release never issues a second order.
  8. Cancel only while ISSUED (ErrCancelAfterAcknowledgement, policy CancelOnSourcingCancel).

Assumptions​

  • order-sourcing releases to a vendor node early enough that ackBy is in the future (its VirtualQueue policy 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 vendorId comes from NodeRegistered.

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.

MetricSourceTarget (judgement)
Share of purchase orders acknowledged before ackByPurchaseOrderAccepted + PurchaseOrderRejected vs PurchaseOrderExpiredExpiry rate tracked per node by node-performance (expiryRate)
Acknowledgement latency (issue to accepted or rejected)PurchaseOrderIssued.time to PurchaseOrderAccepted.acceptedAt / PurchaseOrderRejected.rejectedAtp95 well inside the vendor's ack window
Transaction failure share by kindSubmissionProcessed (kind, status, errorCount)Equals TX_FAILURE_RATE in simulation; near 0 otherwise
Processing lagprocessedAt - notBefore per submissionp95 under one processor tick
429 responses per vendorAPI metricsLow and stable; a spike means a vendor is not honouring Retry-After
Shipments confirmed on timeVendorShipmentConfirmed (shippedAt vs requiredShipBy)Feeds node-performance's on-time handover
Ship-to PII in the Vendor APIContract review of openapi.yamlZero fields, always

Open Questions​

Questions the aggregator's model raised, and how the code settled them:

  • Where does ackBy get handlingTime? Settled: from NodeOperationalProfileDeclared (OnNodeProfileDeclared), stored on the node view. A node with no declared profile has handling time 0, so its ackBy is bounded by the vendor window and requiredShipBy alone.
  • Cancellation after acknowledgement (one race stays open). order-sourcing may cancel a RELEASED assignment while its purchase order is ACK_PROCESSING or ACCEPTED; here cancel is refused (ErrCancelAfterAcknowledgement), logged at INFO (purchase order not cancelled) and nothing is published. An acceptance that arrives after order-sourcing cancelled a RELEASED assignment is only logged there, so the vendor may still ship a cancelled group.
  • Vendor suspension. Settled: POST /vendors/{vendorId}/suspensions and POST /vendors/{vendorId}/reinstatements exist, raise VendorSuspended and VendorReinstated, and a suspended vendor's writes answer 409 vendor-suspended while reads stay open. No consumer reads the two events yet.
  • The label request is synchronous. Settled: POST /vendor/shipping-labels returns 200 with the labels; it is the one write that does not return 202.
  • How does a vendor learn its nodeId? Settled: the processed NODE_REGISTRATION transaction carries the new nodeId (result_node_id).
  • Who is calling? Settled: vendorId is in every write body and a required query parameter on every read; ErrNodeNotOwnedByVendor is 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 FAILURE with the neighbour's Err... code, and a neighbour outage leaves it PROCESSING for up to 5 passes.