Skip to main content

Bounded Context Canvas

Following the ddd-crew Bounded Context Canvas v5. Every message row is checked against the code on develop: routes against apis/openapi.yaml and internal/adapters/inbound/http/handlers.go, events against apis/asyncapi.yaml and the events.go files of internal/domain, the consumed side against internal/adapters/inbound/kafka/node_consumer.go, seller_consumer.go and received_consumer.go.

Canvas at a glance​

Two pictures of the sections below: first the inbound collaborators and what the context does with them, then the outbound collaborators it notifies. Arrows follow the message type: solid blue commands, dotted green queries, thick orange events. Channel names are abbreviated; the tables carry the exact route, topic and CloudEvents type.

Inbound​

Source: apis/openapi.yaml, internal/adapters/inbound/http/handlers.go, internal/adapters/inbound/kafka/node_consumer.go, internal/adapters/inbound/kafka/seller_consumer.go, internal/adapters/inbound/kafka/received_consumer.go, internal/adapters/inbound/mcp/tools.go, internal/adapters/inbound/a2a/skills.go.

Outbound​

Source: apis/asyncapi.yaml, internal/domain/{catalog,listing,feed}/events.go, internal/adapters/outbound/kafka/encoder.go; the consumer side of each edge was read on 2026-11-13 from the sibling's inbound Kafka handlers at origin/develop, not from code here (see Domain events). The context makes no synchronous call, so the Outbound picture has events only.

Name​

Offer and Availability (offer-availability, CloudEvents tier commerce, Go module github.com/claudioed/offer-availability).

Purpose​

To know what the network can sell and from which node:

  • the catalogue item, the network's own entry for a product, with its optional GTIN and packaging hierarchy;
  • one listing per (catalogue item, node, owner);
  • the quantity each node currently claims it can ship for each listing, with the basis the vendor gave for that number (physical stock or throughput-constrained).

It makes the facts available to the contexts that decide (promise and sourcing) as events, so their hot paths make no synchronous call here.

Strategic Classification​

AxisVerdict
DomainSupporting. See the Core Domain Chart and Subdomain classification.
Business ModelRevenue enabler (what can be sold, from where).
EvolutionProduct.

Domain Roles​

RoleApplies?Evidence in the code
SpecificationYes, primaryIt defines what is sellable: catalog.Item, listing.Listing, the LIVE / SUPPRESSED rule tied to node status (listing.ErrNodeNotSellable, listing.Listing.Restore, listing.Listing.Reconcile), and by the owner's status (SellerSuspended, ADR 0013).
Analysis (availability)YesIt turns vendor feeds into per-listing availability: monotonic asOf (listing.ErrStaleAvailability), full-feed zeroing (listing.Listing.ZeroOut). It does not re-derive the vendor's basis.
Execution / Enforcer / GatewayNoIt enforces no deadline and no capacity, and it is not the vendor's entry point (vendor-connectivity is).

Inbound Communication​

CollaboratorMessageTypeChannelRelationship
vendor-connectivityApplyInventoryFeedCommandREST POST /inventory-feeds (in-organization)Customer/Supplier (vendor-connectivity is the Customer)
Network merchandising (human)CreateCatalogItemCommandREST POST /catalog-itemsUI
Network merchandising (human)DiscontinueItemCommandREST POST /catalog-items/{catalogItemId}/discontinuationsUI
Network merchandising (human)DeclarePackLevel, RetirePackLevelCommandREST PUT /catalog-items/{catalogItemId}/packaging/{level}, POST /catalog-items/{catalogItemId}/packaging/{level}/retirementsUI
Network merchandising (human)CreateListingCommandREST POST /listingsUI
StorefrontBrowseCatalog, GetCatalogItemQueryREST GET /catalog, GET /catalog/{catalogItemId}Open Host Service
Any clientListListings, GetInventoryFeedQueryREST GET /listings, GET /inventory-feeds/{feedId}Open Host Service
Agentsthe four read use casesQueryMCP tools browse_catalog, get_catalog_item, list_listings, get_inventory_feed on cmd/mcp; A2A skills check_availability, feed_outcome on cmd/a2aOpen Host Service
node-topologyNodeRegisteredEventKafka retailnetwork.node-topology.events, com.retailnetwork.logistics.node-topology.node.NodeRegisteredConformist
node-topologyNodeActivatedEventsame topic, ...node.NodeActivatedConformist
node-topologyNodeSuspendedEventsame topic, ...node.NodeSuspendedConformist
node-topologyNodeRetiredEventsame topic, ...node.NodeRetiredConformist
seller-inboundSellerSuspendedEventKafka retailnetwork.seller-inbound.events, com.retailnetwork.partner.seller-inbound.seller.SellerSuspendedConformist
seller-inboundSellerReinstatedEventsame topic, ...seller.SellerReinstatedConformist
seller-inboundInboundShipmentReceivedEventsame topic, ...inboundshipment.InboundShipmentReceivedConformist

Outbound Communication​

CollaboratorMessageTypeChannelRelationship
delivery-promise, pricing, product-content, product-discovery, shipping-and-tracking, shopping-cartCatalogItemCreatedEventKafka retailnetwork.offer-availability.events, com.retailnetwork.commerce.offer-availability.catalogitem.CatalogItemCreatedConformist (downstream)
delivery-promise, order-sourcing, pricing, product-content, product-discovery, shopping-cartCatalogItemDiscontinuedEventsame topic, ...catalogitem.CatalogItemDiscontinuedConformist (downstream)
seller-inbound, vendor-connectivityCatalogItemPackagingDeclared, CatalogItemPackLevelRetiredEventsame topic, ...catalogitem.CatalogItemPackagingDeclared and ...CatalogItemPackLevelRetiredConformist (downstream)
delivery-promise, order-sourcing, product-discovery, vendor-connectivityListingCreatedEventsame topic, ...listing.ListingCreatedConformist (downstream)
delivery-promise, order-sourcing, product-discovery, seller-inboundListingAvailabilityChangedEventsame topic, ...listing.ListingAvailabilityChangedConformist (downstream)
delivery-promise, order-sourcing, product-discoveryListingSuppressedEventsame topic, ...listing.ListingSuppressedConformist (downstream)
delivery-promise, order-sourcing, product-discoveryListingRestoredEventsame topic, ...listing.ListingRestoredConformist (downstream)
node-performanceInventoryFeedAppliedEventsame topic, ...inventoryfeed.InventoryFeedAppliedConformist (downstream)
(none)noneSync callThe service has no outbound clientnone

Full message details: Domain events. Relationship evidence: Context map.

Ubiquitous Language​

Full glossary: Ubiquitous language. Top terms: Catalog Item, Listing (not a Catalog Item), Available Quantity, Availability Basis PHYSICAL / THROUGHPUT_CONSTRAINED / UNKNOWN, Inventory Feed, Full Feed, asOf, Pack Level, GTIN.

Business Decisions​

  1. A listing is sellable only while its node is ACTIVE (listing.Create starts a listing SUPPRESSED otherwise; listing.ErrNodeNotSellable; policy SuppressOnNodeUnavailable in usecases.ApplyNodeEvent). An unknown node is not sellable.
  2. A feed older than the node's last applied feed is SUPERSEDED (feed.Superseded, node_feed_marks); per listing, a line whose asOf is not after the current one is skipped and counted (listing.ErrStaleAvailability).
  3. A full feed zeroes every listing of that node it omits, keeping the basis (listing.Listing.ZeroOut).
  4. The basis the vendor declares is kept with the number, never re-derived.
  5. One listing per (catalogItemId, nodeId, ownerRef) (listing.ErrDuplicateListing, listings_item_node_owner_key).
  6. A feed is applied at most once, atomically (feed.ErrFeedAlreadyApplied), and every line names a listing of the feed's node (feed.ErrListingNotOnNode); a bad line fails the whole feed (FAILED) and changes nothing.
  7. Discontinuation is final and suppresses the item's listings with reason DISCONTINUED, which no node event restores.
  8. A GTIN identifies one item or pack level forever (catalog.ErrGtinAlreadyAssigned); a pack level above EACH needs an active lower child level (catalog.ErrPackLevelOrder).
  9. A seller's suspension also keeps its listings off the shelf. SellerSuspended suppresses the seller's LIVE listings with OWNER_SUSPENDED (usecases.ApplySellerEvent); a listing shows the highest active cause, DISCONTINUED > NODE_NOT_SELLABLE > OWNER_SUSPENDED (listing.Sellability.Cause, ADR 0013). InboundShipmentReceived creates the seller's listing for each received item that has none on the node (usecases.ApplyReceivedStock, ADR 0014).

Assumptions​

  • node-topology publishes every node status change keyed by nodeId, so the local node_status_view sees them in order per node; an older observation is ignored anyway.
  • vendor-connectivity checks that a vendor acts only on its own nodes before it calls POST /inventory-feeds; this context does not know vendors and has no such check.
  • vendor-connectivity owns the asynchronous transaction, rate limits and the 202 answer to the vendor.
  • Consumers of availability keep their own views from events; none calls this context on a hot path.
  • Feeds and consumer inbox rows are retained 30 days, idempotency keys 24 hours (internal/adapters/outbound/postgres/retention.go).

Verification Metrics​

One instrument exists: availability.inventory_feeds.applied (counter, one increment per feed outcome applied, superseded, failed or rejected, with reason on the last two); see Observability. Proposed, not built: apply latency percentiles, the share of stale lines, suppression lag after NodeSuspended or NodeRetired, and outbox lag.

Open Questions​

  • Feed correlation. Whether feedId is vendor-connectivity's transaction id is that service's decision; this context accepts any well-formed id and treats a re-sent FAILED id as a retry.
  • No contract test against the consumers. The downstream list was recomputed on 2026-11-13 from each consumer's inbound Kafka handlers; no consumer-driven contract test exists in this repository (Integration).
  • Atomic application at volume. A full feed touches every listing of a node in one transaction under the node's mark lock; there is no measured throughput figure.