Catalog My learning Blog
Event-Driven Architecture Course: Event Sourcing and CQRS · Phase 1 · Lesson 1 · 8 min read

Request-Driven vs Event-Driven Architecture

On this page
  1. Learning Objective
  2. Concept Explanation
  3. Worked Example: The Same Order Flow, Written Both Ways
  4. Real-World Examples
  5. Review Questions & Answers

Learning Objective

Explain the difference between request-driven and event-driven integration, describe exactly what changes about coupling, availability, and failure behavior when a system moves from one to the other, and identify the scaling pressures that push teams to make that move in the first place.

Concept Explanation

A request-driven system is built from calls. One service knows another service exists, knows its address and its contract, invokes it directly, and waits for an answer before it can finish its own work. This is the default shape of almost every system, and for good reason: it is simple to reason about, it is easy to debug because the whole causal chain sits inside one stack trace, and it gives an immediately consistent answer because the caller does not proceed until the callee has actually done the work. When an order service calls a payment service and gets back an authorization code, the order service knows, right now, whether payment succeeded.

An event-driven system is built from announcements. A service does its own work, records that something happened as an event, and publishes that event to a broker without knowing or caring who consumes it. Consumers subscribe to the events they care about and react on their own schedule. The order service no longer calls the payment, inventory, email, analytics, and fraud services; it publishes OrderPlaced and moves on. The critical structural change is the direction of the dependency: in request-driven integration, the producer of work depends on every consumer of that work, while in event-driven integration, each consumer depends on the event contract and the producer depends on nobody.

That inversion is what makes the pattern worth the trouble. In a request-driven design, every new downstream capability means editing the upstream service: a new fraud check means a new call inside the order flow, a new deploy of the order service, a new failure mode in the order path, and a new team that has to negotiate with the order team to get anything shipped. In an event-driven design, a new fraud service subscribes to OrderPlaced and ships independently; the order service never learns it exists. This is the difference between an integration cost that grows with the number of pairs of services and one that grows with the number of services.

The second structural change is temporal. A synchronous call binds the availability of the caller to the availability of the callee: if the payment service is down, the order request fails, and if five services are chained, the overall availability is roughly the product of the individual availabilities. An event published to a durable broker decouples in time as well as in identity. The consumer can be down for ten minutes, restart, and process the backlog from where it left off, and the producer never noticed. What the producer gives up in exchange is the answer: it no longer knows, at the moment it returns to the user, whether the downstream work succeeded. That trade, immediate certainty for independent availability, is the single most important thing to understand about this entire course.

The scaling pressures that push teams toward events are usually concrete rather than philosophical. A synchronous call chain that grows past three or four hops starts producing latency that is the sum of every hop and availability that is the product of every hop. A single upstream service accumulates a long list of downstream calls that all have to be maintained, retried, timed out, and circuit-broken. Teams start blocking each other because every new consumer requires an upstream change. And the same data needs to reach four different places at once, a search index, a cache, a data warehouse, and a notification system, which is a fan-out problem that point-to-point calls handle badly and a published event handles naturally.

DimensionRequest-DrivenEvent-Driven
Dependency directionProducer depends on every consumer it callsConsumers depend on the event contract; the producer depends on nobody
Availability couplingCaller fails when callee is down; chained availability multipliesProducer succeeds even if every consumer is down; the broker buffers
ConsistencyImmediately consistent - the caller has the real answer on returnEventually consistent - the answer arrives later, if at all, out of band
Adding a consumerRequires changing and redeploying the producerRequires no change to the producer at all
DebuggingOne stack trace, one request id, one clear causal chainDistributed trace across brokers and consumers, causality must be reconstructed
Latency profileSum of every hop, paid by the user synchronouslyProducer returns fast; downstream work completes on its own schedule

Worked Example: The Same Order Flow, Written Both Ways

The two versions below do the same business work. The difference is not what happens but who knows about whom, and what the user is made to wait for.

JavaScript
// REQUEST-DRIVEN: the order service knows five other services by name,
// waits for all of them, and fails if any one of them is unavailable.
async function placeOrder(cart, user) {
  const order = await db.orders.insert({ userId: user.id, items: cart.items });
  await paymentService.charge(user.id, cart.total);   // if down -> order fails
  await inventoryService.reserve(cart.items);         // if down -> order fails
  await emailService.sendConfirmation(user.email);    // if down -> order fails
  await analyticsService.track('order_placed', order);
  await fraudService.score(order);
  return order;                                       // latency = sum of 5 hops
}

// EVENT-DRIVEN: the order service does its own work, states the fact, and
// returns. It does not know that payment, inventory, email, analytics or
// fraud exist. Each of them subscribes independently.
async function placeOrder(cart, user) {
  const order = await db.orders.insert({ userId: user.id, items: cart.items });
  await broker.publish('orders.placed', {
    eventId: uuid(),
    orderId: order.id,
    userId: user.id,
    items: cart.items,
    total: cart.total,
    occurredAt: new Date().toISOString(),
  });
  return order;                                       // latency = 1 insert + 1 publish
}

// Adding a sixth consumer (say, a loyalty-points service) means writing a
// new subscriber. It does not mean touching placeOrder at all.
The same order flow drawn twice: a request-driven version where the order service holds a direct dependency on five downstream services and waits for each, and an event-driven version where it publishes one event to a broker and five independent consumers subscribe to it.
The same order flow drawn twice: a request-driven version where the order service holds a direct dependency on five downstream services and waits for each, and an event-driven version where it publishes one event to a broker and five independent consumers subscribe to it.

Real-World Examples

  • LinkedIn built Apache Kafka in 2010 precisely because point-to-point data integration had stopped scaling: the company was maintaining a growing tangle of bespoke pipelines connecting each source system to each destination system, and the engineering team, led by Jay Kreps, replaced that tangle with a single durable, replayable log that every producer wrote to and every consumer read from. Kafka was open-sourced in 2011 and became an Apache project, and the design rationale is documented publicly in Kreps's widely cited essay "The Log: What every software engineer should know about real-time data's unifying abstraction."
  • Netflix runs its Keystone data pipeline on Kafka and has publicly reported processing on the order of a trillion events per day across its streaming platform, fanning a single stream of playback and UI events out to independent consumers for real-time analytics, personalization, and operational monitoring. The point of the architecture is exactly the fan-out property described in this lesson: the services that emit playback events do not know which of the dozens of downstream systems consume them.
Key TakeawaysEvent-driven architecture inverts the dependency direction: instead of a producer knowing every consumer, each consumer knows only the event contract. You gain independent deployment, independent availability, and cheap fan-out. You pay for it with eventual consistency, because the producer returns to the user before the downstream work has actually happened, and with distributed debugging, because the causal chain no longer fits in one stack trace.

Review Questions & Answers

A synchronous call cannot succeed unless the callee succeeds, so the overall success probability is roughly the product of the individual availabilities rather than the minimum. Five services at 99.9 percent each give roughly 99.5 percent combined, which is about five times more downtime than any one of them has on its own. An event published to a durable broker breaks that multiplication, because the producer can succeed and the broker can hold the event until each consumer is healthy again.

What is removed is coupling to identity, location, and availability: the producer no longer needs to know which services consume its output, where they are, or whether they are running. What remains, and what is often underestimated, is coupling to the event schema. Every consumer depends on the shape and meaning of the event, so changing a field name or altering the semantics of an event breaks consumers just as surely as changing a REST contract would. Event-driven systems trade one kind of coupling for a different kind, not for no coupling.

In the request-driven version, a new consumer requires editing the producer to add a call, testing that change, deploying the producer, and accepting a new failure mode and new latency in the producer's critical path, which means a new team cannot ship without the producer team's involvement. In the event-driven version, the new consumer subscribes to an event that is already being published, deploys entirely on its own schedule, and the producer's code, tests, latency, and failure surface are all unchanged. The organizational effect is usually larger than the technical one.

It gives up the answer. A synchronous call returns a result the caller can act on immediately, so the order service can tell the user right now that payment succeeded or failed. A published event returns nothing about the outcome of downstream processing, so the system must either communicate a provisional state to the user, "order received, we will confirm payment shortly," or provide a separate mechanism, a status endpoint, a push notification, a later email, to deliver the eventual outcome. That user-visible consequence is the real cost of eventual consistency, not an abstract theoretical one.