Concepts

Event-Driven Architecture

Architectural pattern where components communicate through asynchronous events, enabling decoupled, scalable, and reactive systems.

seed#event-driven#architecture#async#decoupling#events#messaging

What it is

Event-driven architecture is a pattern where components produce and consume events asynchronously. An event represents something that happened — an order created, a file uploaded, a user registered. Producers don't know who consumes their events; consumers don't know who produces them.

Components

  • Event: immutable record of something that happened
  • Producer: component that emits events
  • Consumer: component that reacts to events
  • Broker/Bus: infrastructure that routes events

Patterns

  • Event notification: notify that something happened (without complete data)
  • Event-carried state transfer: the event contains all necessary data
  • Event sourcing: state is derived from the sequence of events
  • CQRS: separate reads from writes using events

Broker comparison

BrokerModelOrderingRetentionUse case
AWS SQSQueue (point-to-point)Optional FIFO14 days maxSimple service decoupling
AWS SNSPub/sub (fan-out)Not guaranteedNo retentionNotifications to multiple subscribers
AWS EventBridgeEvent busPer partition24h replayContent-based routing, SaaS integration
Apache KafkaDistributed logPer partitionConfigurableHigh-volume streaming, event sourcing
RabbitMQQueue with exchangesPer queueConfigurableComplex routing, multiple protocols

Benefits

  • Decoupling: producers and consumers evolve independently
  • Scalability: add consumers without modifying producers
  • Resilience: isolated failures, automatic retries
  • Auditability: complete event history

Challenges

  • Eventual consistency (not immediate)
  • More complex debugging (distributed flows)
  • Event ordering
  • Consumer idempotency

Why it matters

Event-driven architectures decouple services in time and space. A service publishes an event without knowing who consumes it, enabling independent scaling, modification, and replacement of components. It is the pattern that enables truly modular systems.

References

Concepts