Skip to main content

Domain events

The Storefront BFF publishes no event and consumes none. There is no event catalogue to list, no AsyncAPI document (apis/ holds only openapi.yaml), no Kafka topic and no consumer group. This page records the evidence, so nobody searches for events that do not exist, and what the service does in their place.

Evidence​

CheckResult
apis/openapi.yaml only; no asyncapi.yaml
cmd/api/main.go wiringconfig.Load, startTelemetry, rest.New, usecases.NewGateway, inbound.NewServer: no Kafka writer, reader, outbox or CloudEvents encoder
Environmentno KAFKA_BROKERS, consumer group or topic variable (Configuration)
CIapi-lint lints the OpenAPI document only; ci.yml notes the edge "publishes/consumes no events by design"
ADR 0001"Published: none (read side). Consumed: none. No warehouse.* topic is consumed or produced."
Template leftoversinternal/adapters/outbound/kafka (writer) and internal/adapters/kafka/cloudevents (envelope) exist from the fleet scaffold but nothing in cmd/api imports them; their tests and the Kafka and CloudEvents fitness sensors stay green

What the BFF has instead​

NeedHow the BFF meets it without an event
Tell the web app a cart or order changedIt does not: the page asks again. Every answer is the upstream's current state, relayed.
Know a payment is settledThe page polls GET /checkout/{id} while a placement is in doubt (a 202); see Sequence diagrams.
Record what happenedOne structured http request log line per request with route, status, duration and ids, never a body (Observability).
Keep a retry safeA deterministic Idempotency-Key instead of an outbox: the upstream owns de-duplication (Use cases).

Reserved namespace​

ADR 0001 reserves, for the day an event exists:

  • CloudEvents type: com.retailnetwork.storefront.storefront-bff.<entity>.<Event>
  • Topic: retailnetwork.storefront-bff.events, and .analytics for analytics-only events.

Nothing uses either. Facts about carts, checkouts, payments and orders are published by their owners in the upstream services and are catalogued on the aggregator's storefront site, not here.

If an event is ever added​

It would be the first stateful behaviour of the service, so it needs an ADR first. At minimum: an apis/asyncapi.yaml, a transactional outbox (which needs a database, which the service does not have), the kafka and cloudevents packages wired in cmd/api, KAFKA_BROKERS in the configuration page and chart, and an event catalogue page api-reference/events in this site's sidebar. The architecture sensors (TestEventCatalogueMatchesContract, TestCloudEventsOnly, the writer and outbox sensors) would then start guarding it.