Skip to content

Architecture pattern

Event-driven integration behind an API front door

Let partners and apps publish and receive events through familiar, governed HTTP APIs, while an event broker does the fan-out behind the gateway.

Event-driven integration behind an API front door. Architecture diagram, with the numbered flow listed below it.
Event-driven integration behind an API front doorPartners publish events over HTTPS to an API gateway, which validates them against a schema and produces them to an event broker. Internal services consume from the broker, and a delivery service pushes events back out to client apps.Outside partiesAPI front doorEvent platformInternal consumersPartner systemsPublish over HTTPSClient appsReceive updatesAPI gatewayAuth, validation, quotasSchema registryEvent contractsEvent deliveryWebhooks, SSE, WebSocketEvent brokerKafka or similarOrder processingConsumer groupAnalyticsStream processing1234456
  • Caller
  • Gateway
  • Component you run
  • Control, identity or policy
  • Request
  • Event or background

How it flows

  1. Partner systems to API gatewayPublishes an event as an HTTPS request, authenticated like any other API call.
  2. API gateway to Schema registryValidates the payload against the registered schema and rejects bad events early.
  3. API gateway to Event brokerProduces the event to a topic and returns an acknowledgement.
  4. Event broker to Order processing and Analytics (asynchronous)Consumers read at their own pace and can replay from an offset.
  5. Event broker to Event delivery (asynchronous)Selected topics feed an outbound delivery service.
  6. Event delivery to Client apps (asynchronous)Pushes events to subscribers, with retries and signed payloads.

The problem

Event streaming platforms such as Kafka are excellent inside the organisation, but exposing them directly to partners or client apps is hard. Native protocols need special clients, firewall changes and broker-level credentials. Meanwhile many integrations are still point-to-point HTTP calls that break whenever one side is slow.

When to use it

  • External parties need to send or receive events but should not connect to the broker directly.
  • Several internal consumers need the same events, at their own pace.
  • You want the same authentication, quotas and analytics for events as for your REST APIs.
  • Producers and consumers should be decoupled, so a slow consumer does not slow the producer.

When not to

  • The caller needs an immediate, consistent answer, such as checking a balance before a payment. Use a synchronous API.
  • Very high-throughput internal streams between services that already speak the broker's protocol. Putting HTTP in the middle adds cost without benefit.
  • When nobody owns event contracts. Without schemas and versioning, events become an undocumented coupling.

Key components

  • API gateway as front door. Authenticates publishers, applies quotas, and translates HTTP requests into produce calls on the broker.
  • Schema registry. Holds event contracts, so bad payloads are rejected at the edge rather than poisoning a topic.
  • Event broker. Stores events durably and lets each consumer group read and replay independently.
  • Outbound delivery. Webhooks, server-sent events or WebSocket connections that push selected events to subscribers, with retries and signatures.
  • Catalogue. A shared place where teams discover both APIs and event streams, often described with OpenAPI and AsyncAPI.

Trade-offs

  • Eventual consistency. Accepting an event is not the same as processing it. Clients must handle "accepted" and check outcomes later.
  • Ordering and duplicates. Most brokers guarantee order only within a partition, and delivery is usually at least once. Consumers must be idempotent.
  • Webhook reliability. Outbound delivery needs retries, back-off, dead-letter handling and a way for subscribers to catch up.
  • Two governance models. API and event governance must line up, or the front door becomes a translation layer nobody understands.

Explore further

Weighing this up for your platform?