Architecture style

Event-driven architecture

Components communicate by publishing and reacting to events, so they stay loosely coupled and scale independently.

DecouplingScalingFault toleranceEvent routingPublish and subscribeQueueing

Overview

In an event-driven architecture, a component that does something worth knowing about publishes an event ("order placed", "file uploaded"), and other components that care react to it. The publisher does not call them and does not know who they are. A broker (a queue, a topic or an event bus) sits in between and delivers each event.

Three roles appear in every design: producers that emit events, routers that decide where events go, and consumers that react. Because they only share the event's shape, each can be changed, scaled and deployed on its own.

When it fits

  • Work can finish after the user's request has been answered (sending email, generating reports, charging a card).
  • Several independent parts must react to the same thing.
  • Load is bursty, and you want a buffer so spikes do not overwhelm downstream systems.
  • Teams own different parts and need to evolve them separately.

When to avoid it

  • The caller needs the result immediately to continue (a price lookup, a login check): a direct call is simpler.
  • The system is small and one team owns all of it: the extra moving parts may not pay off.
  • You need strict, simple, end-to-end transactions across steps: eventual consistency makes these harder.

Complexity

More moving parts than a direct call: brokers, retries, dead-letter queues and monitoring. Debugging a flow means following an event across components, so correlation IDs and tracing matter. The shape of events becomes a contract that teams must manage and version.

Deployment model

Each producer and consumer is deployed separately, often as functions or small services, with managed brokers in between. On AWS the brokers are usually SQS, SNS and EventBridge; Kinesis and MSK carry ordered streams.

Scaling characteristics

Consumers scale on the backlog of work, independently of producers. A queue absorbs a spike and consumers catch up; a topic or bus lets new consumers be added without changing the producer.

Operational trade-offs

  • Eventual consistency: other components learn about a change slightly later, so screens and APIs must handle "in progress".
  • At-least-once delivery: the same event can arrive twice, so consumers must be idempotent.
  • Ordering: guaranteed only where the broker offers it (FIFO queues, per-partition streams), and usually per key rather than globally.
  • Failure handling is explicit: you decide on retries, backoff and what goes to a dead-letter queue.

Related

Courses and lessons

Services, comparisons and patterns

Sources

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake