Skip to main content

Integration

How customer-ordering fits with the rest of the fleet, with the status of every edge. Producer and caller sides were read on each sibling's origin/develop on 2026-10-31 (delivery-promise, order-sourcing, shipping-and-tracking, checkout, storefront-bff, warehouse-ops-agent, warehouse-infra); the words are used strictly:

  • Built: code on this repo's develop that does the job.
  • Verified: the other side has code that matches.
  • Absent: no code on either side.

This context makes exactly one outbound call to another service, delivery-promise, and consumes the Kafka topics of three siblings. It never calls order-sourcing or shipping-and-tracking, and cmd/mcp and cmd/a2a call nobody (TestMCPServerIsReadOnly, TestA2AServerIsReadOnlyAndHasNoOutboundClient).

Edge map​

Source: internal/adapters/outbound/deliverypromise/gateway.go, internal/adapters/inbound/kafka/handlers.go, internal/adapters/outbound/kafka/encoder.go, apis/asyncapi.yaml, apis/openapi.yaml and the sibling files named in the tables. Solid arrows are synchronous; dotted arrows are Kafka.

Upstream: what customer-ordering calls​

ProducerProtocolContractFailure behaviourStatus
delivery-promiseREST, base URL DELIVERY_PROMISE_URL (required), timeout DELIVERY_PROMISE_TIMEOUT (default 5s), response read capped at 1 MiBPOST /delivery-quotes (a fresh UUID Idempotency-Key per call); POST /promises (Idempotency-Key <orderId>:<groupNo>); POST /promises/{id}/confirmations (key <orderId>:<groupNo>:confirm); POST /promises/{id}/cancellations (key <orderId>:<groupNo>:cancel, the compensation)404/409/422 are typed refusals (offer-not-quotable, promise-capacity-exhausted, book-closed, group-spans-nodes); a timeout, transport error, 5xx or undecodable answer is delivery-promise-unavailable (503, retry with the same Idempotency-Key). Nothing is stored and a confirmed group is cancelled again.Built + verified (the producer's consumes/REST routes name this caller)
delivery-promiseKafka, CloudEvents 1.0, retailnetwork.delivery-promise.events, group DELIVERY_PROMISE_CONSUMER_GROUPPromiseAtRisk, PromiseRevised, PromiseKept, PromiseBroken, PromiseUnkeepablesee How every consumed message is handledBuilt + verified
order-sourcingKafka, retailnetwork.order-sourcing.events, group ORDER_SOURCING_CONSUMER_GROUPFulfillmentLocked, FulfillmentShipped, FulfillmentUnsourceable, FulfillmentCancelled, FulfillmentCancelRefusedsameBuilt + verified
shipping-and-trackingKafka, retailnetwork.shipping-and-tracking.events, group SHIPPING_CONSUMER_GROUPLabelIssued, LabelVoided, PackageScanned, PackageDelivered, PackageExceptionRaised, PackageLost, PackageReturned, PackageEtaWindowAssigned, PackageDeliveryPointFlagged, PackageReadyForCollection, PackageCollectedsameBuilt + verified

Full types and effects are on the Event catalogue. Every type is dispatched in full; the three group ids have no default and a missing one is a boot error.

How every consumed message is handled​

(internal/adapters/inbound/kafka, internal/application/usecases/consume_*.go)

  • The CloudEvents id is claimed in processed_events in the same transaction as the effect; the Kafka offset is committed afterwards. A replayed id changes nothing.
  • A message that is not a valid CloudEvent is logged at WARN and committed past.
  • A handling failure is retried with capped backoff (200 ms to 5 s), 5 attempts, then the message is published to <topic>.dlq with x-dlq-* headers. A payload that can never be applied (undecodable) is dead-lettered at once. Shutdown never dead-letters.
  • An unknown order or group, a status regression and an illegal transition are logged as consumed event skipped and acknowledged (ADR 0002, A7). A delivery or outcome that arrives before the shipment is known is stored and replayed when FulfillmentShipped arrives.
  • The readers dial lazily, so a broker outage never blocks boot; if a consumer or the relay returns on its own the process exits non-zero and is restarted (Runbook).

Downstream: who uses customer-ordering​

ConsumerProtocolContractStatus
order-sourcingKafka, retailnetwork.customer-ordering.events, its group order-sourcing-customer-orderingCustomerOrderPlaced (one assignment per group), CustomerOrderCancelled (cancel request per listed group)Built + verified in its apis/asyncapi.yaml and internal/adapters/inbound/kafka/handlers.go
delivery-promiseKafka, same topicCustomerOrderPlaced is a reconciling ConfirmPromise (a repeated confirm is a no-op); CustomerOrderCancelled cancels the promises of the named groupsBuilt + verified (internal/adapters/inbound/kafka/dispatch.go, OnCustomerOrderPlaced, OnCustomerOrderCancelled)
checkoutREST (CUSTOMER_ORDERING_URL)POST /checkout through its customer-ordering anti-corruption adapterBuilt + verified on the caller side
storefront-bffREST (CUSTOMER_ORDERING_URL)the shopper routes only; a fitness test (bff_no_inorg_route_fitness_test.go) forbids the in-org ship-to routeBuilt + verified on the caller side
shipping-and-trackingREST (CUSTOMER_ORDERING_URL, required there)GET /orders/{orderId}/ship-to before it issues a label; if this context is unreachable the label is refused with ship-to-unavailableBuilt + verified on the caller side
warehouse-ops-agentMCP over HTTP (CUSTOMER_ORDERING_MCP_ENDPOINT, http://customer-ordering-mcp:8090/mcp in the cluster)get_order, get_order_tracking, get_ship_to; its client is pinned against internal/adapters/inbound/mcp/testdata/tool_registry.golden.jsonBuilt + verified on the caller side
agentsA2A at /api/a2a/customer-orderingskills get_order, get_order_trackingBuilt; no known fleet client

Publication is through the transactional outbox: the order row and its already-encoded events are written in one transaction and the always-on relay drains them to Kafka at least once, repeating the stored CloudEvents id, capped by OUTBOX_MAX_ATTEMPTS (Runbook).

Infrastructure wiring​

warehouse-infra (origin/develop) installs the chart with helm-values/customer-ordering.yaml: consumer groups customer-ordering-delivery-promise, customer-ordering-order-sourcing and customer-ordering-shipping; deliveryPromiseUrl pointing at the delivery-promise Service; Kong routes /api/customer-ordering, /api/mcp/customer-ordering and /api/a2a/customer-ordering; the mcp, a2a and frontend components enabled. Topics are auto-created by the first writer; a consumed topic whose producer has not written yet shows as consumer retry logs, not as unreadiness.

Absent edges (on purpose)​

  • No call to order-sourcing or shipping-and-tracking. Their facts arrive as events only; the tracking view is event-fed and this context never calls GET /journeys/{trackingNumber} of shipping-and-tracking.
  • No warehouse.* topic and no warehouse-systems service (WMS/WES) is consumed or called.
  • No payments, notification or returns edge. customer-payments (storefront) and returns-processing (WMS) exist as contexts, but no code or contract of this repository references either: the three consumed topics are retailnetwork.delivery-promise.events, retailnetwork.order-sourcing.events and retailnetwork.shipping-and-tracking.events, the only produced topic is retailnetwork.customer-ordering.events, and apis/openapi.yaml has no payment or return operation. customer-payments consumes checkout, order-sourcing and shipping-and-tracking events, not this context's. No invoice, tax or notification context was found in the IQVO organisation.
  • MCP and A2A are inbound and read-only: they wire read use cases only, own no Kafka adapter and no outbound client.
  • The web remote (web/, customer_ordering_mfe) calls only this context's own /api/customer-ordering.

Failure behaviour​

SituationBehaviour
delivery-promise down or slow at checkout503 delivery-promise-unavailable, no order stored, promises of the same checkout already confirmed are cancelled; retry with the same Idempotency-Key.
Offer expired or consumed409 offer-not-quotable with fresh offers; nothing placed.
Postgres down at bootRetried with backoff (bootretry), then the process exits 1.
Postgres down at runtimeREST answers 500 internal-error; consumers fail transiently, retry and dead-letter; /readyz is 503. cmd/mcp and cmd/a2a fail their reads.
Kafka downREST writes still commit (events wait in outbox_events); /readyz is 503; the relay retries every OUTBOX_RELAY_INTERVAL; consumers block on the reader and resume.
Duplicate or replayed eventDropped by the inbox, no effect.
Poison messageDead-lettered, the partition moves on.
Sibling producer not yet runningConsumer retry logs; the order stays in its last known status.