Event-Driven Architecture
Event-Driven Architecture (EDA) is a style in which services communicate by publishing and subscribing to events on a message bus, rather than calling each other synchronously. Producers emit events when something happens; consumers react to those events independently. The pattern reduces coupling and enables fan-out, replay, and asynchronous processing.
How it works
A producer publishes an event (typically a JSON or Avro message) to a topic on a broker. The broker stores the event durably and delivers it to all subscribed consumers. Consumers may run at their own pace, replay history, or join later and catch up from the beginning. The producer does not know or care who consumes.
Common patterns
- Event notification. "Something happened, here is the ID." Consumers look up details if they need them.
- Event-carried state transfer. The event carries the full state, so consumers do not need to call back.
- Event sourcing. The event log is the source of truth; current state is derived by replaying events.
- CQRS. Reads and writes go through different models, often paired with event sourcing.
Common brokers
- Apache Kafka, Redpanda, AWS Kinesis, Google Pub/Sub, Azure Event Hubs, NATS JetStream, RabbitMQ Streams, Pulsar
🔗