Event-driven architecture: patterns, brokers, and trade-offs
Event-driven architecture means services announce what happened and let whatever's listening react independently. How publish and subscribe changes coupling, the core patterns, how brokers differ, and the eventual consistency cost teams underestimate.
On this page
Event-driven architecture (EDA) is a way of structuring software so that services announce facts instead of calling each other to request an action: a payment cleared, a file finished processing, a sensor crossed a threshold. Whatever depends on one of those facts subscribes to it and decides independently what to do next, and the service that raised the event doesn't know who's listening or how many.
You pay for that indirection with extra moving parts, and you get loose coupling back. Take a subscription cancellation. It's one event. Billing stops the next charge, a retention workflow queues an offer email, and an analytics job logs the churn reason. None of those services calls another.
Publish, subscribe, and coupling
Publish and subscribe names the two roles. A publisher emits an event to a channel (a topic or a queue, depending on the broker) without specifying who should act on it. A subscriber registers interest in that channel and gets every event published there, whether one service is listening or twenty. Neither side holds a reference to the other.
Compare that with a direct call. Change the callee's interface and the caller breaks immediately. The caller also has to know the callee exists and wait for its response. An event carries none of that weight, so you can add or rewrite consumers without touching the publisher's code. System integration treats this as one pattern among several. Event-driven architecture is a system built around that shape by default, not bolted on for a single connection.
Event-driven architecture patterns
Martin Fowler's overview of event-driven patterns is a good map here, since "event-driven" gets used for several quite different designs.
Event notification is the plainest version. The event carries just enough to identify what happened, an order ID and a status, say, often wrapped in a standard envelope like CloudEvents, a graduated CNCF project. A consumer that needs more detail calls back to fetch it.
Event-carried state transfer skips that callback by putting the full record in the event instead of a pointer to it. Consumers keep working even when the source system is down. The catch is that each one now holds a copy that drifts out of date if nobody refreshes it.
Event sourcing and CQRS
Event sourcing makes the event log the source of truth rather than a side effect. Instead of storing current state and overwriting it, the system stores every event and derives state by replaying them. You get a full audit trail for free. You also get a system that's harder to query directly.
CQRS splits the model in two: one path handles writes, a separate model serves reads. It's often paired with event sourcing (the write side appends events, the read side builds projections from them), but you can use either without the other. With CQRS, the read model lags the write model by however long its projection takes to catch up. That's the same eventual consistency problem covered below.
Choosing a broker
Product names hide the constraints that actually matter: how long events are kept, whether you can replay them, and where ordering holds.
Apache Kafka is a distributed log. Every event lands in a partition, ordered within it, and stays for a retention window set by time, size, or both, instead of disappearing once read. Multiple consumer groups can replay the same stream independently, as far back as retention allows. Running it yourself means operating brokers and, since Kafka 4.0 dropped ZooKeeper, a KRaft controller quorum. It pays off at real volume, not for a handful of events an hour. If you're weighing Kafka against a compatible alternative, see Redpanda vs Kafka.
RabbitMQ is built around queues and routing. An exchange (direct, topic, fanout, or headers) routes each message to a queue, and a classic or quorum queue deletes the message once a consumer acknowledges it. That fits work distribution and complex routing well. Replay on plain queues isn't possible, but RabbitMQ Streams add an append-only log with retention and consumer rewind when you need it.
Managed services such as AWS SNS and SQS or Google Cloud Pub/Sub give up some control for a much smaller operational footprint. A managed topic paired with a managed queue covers the fan-out-then-process shape most teams need. Replay exists but is bounded: Pub/Sub can seek to a timestamp or snapshot, and SNS FIFO topics support message archiving and replay. Azure Service Bus and Event Hubs, NATS, and Pulsar fit the same categories.
The cost of eventual consistency
Every pattern above gives up one guarantee in exchange for decoupling: that anyone reading data right now sees its latest version. A consumer processes an event on its own schedule, usually a short delay but with no fixed upper bound, so two parts of the same system can disagree about one fact for a while.
Delivery guarantees make this harder, not easier. Brokers overwhelmingly promise at-least-once delivery. A dropped connection or a crash before acknowledgment redelivers a message, so the same event can be processed twice. Assuming exactly-once by default is a mistake that tends to surface as double charges or inflated counts. Most systems need a consumer that handles a repeat without double-counting anything, the same idempotency question API integration covers, applied here to a subscriber.
Ordering works the same way. Events from different producers, or different partitions of the same topic, can arrive out of sequence. An operation that has to look atomic to a customer, an order and its payment, say, reaches for a saga instead of one transaction: a chain of local commits, each paired with a way to compensate if a later step fails. You accept a brief partial state so you never lock across services.
Event-driven architecture vs microservices
They answer different questions. Microservices is about how you split a system into independently deployable services. Event-driven architecture is about how parts of a system communicate. A microservices system can run entirely on direct API calls, and a monolith can publish events between its own modules. The two show up together often because events let separately owned services react to each other without coordinating releases.
The case against going event-driven
A team running one service has nobody to publish to. Every event it emits has exactly one consumer: itself. Publish and subscribe still adds a broker to operate, and turns a debugging session that used to be a stack trace into a search across several services' logs. A direct function call gave you a stack trace without any of that.
It starts paying off once independent teams need to react to the same facts without waiting on each other's release schedule. Picture a logistics system where pricing and fraud checks belong to separate teams, each reacting to a shipment event on its own. It also helps when one slow consumer, a compliance export, say, shouldn't block everything else.
Schemas deserve more care here than in a direct call, because a bad one gets copied into every consumer that reads it, and fixing it later means coordinating a change across every subscribed team. Software development consulting can review event schemas before the first one ships; custom software development and product development cover the buildout once they're settled. Team size alone doesn't decide it. What matters is whether more than one independent consumer is waiting on the other end.
Frequently asked questions
A way of building software where services announce what happened instead of asking each other to do something. A shipping service says a package left the warehouse; it doesn't know or care which other services act on that fact, or how many there are. Each one decides independently what to do next.
No. Most systems run both. A REST call looks something up right now; an event announces a fact for whatever's listening to react to later. Many systems expose synchronous APIs for lookups and publish events for state changes.
They're separate ideas, and you can have either one without the other. Microservices describes how a system splits into independently deployable services. Event-driven architecture describes how those services, or a single monolith's internal modules, communicate once split. A microservices system can talk entirely through direct API calls, and a monolith can publish events internally without being broken into separate services at all.
Mostly with correlation IDs. One identifier is assigned when an event is first published and travels with every message derived from it, so a single query pulls every related log line. For distributed traces, teams usually propagate a W3C Trace Context header through OpenTelemetry as well; a trace ID and a correlation ID often coexist but aren't the same thing.
An online store publishes an "order placed" event. Inventory reserves stock, payments charges the card, and email sends a confirmation, each reacting on its own. If the email service is down for ten minutes, orders still go through and the confirmations catch up once it's back.
Keep exploring
System integration: patterns, methods, and when you need it
A plain-language reference on system integration, covering what it means, the four patterns teams actually use, how to pick one, and the failure modes that make integration projects overrun.
6 min readEngineeringTransaction management: ACID properties, isolation levels, sagas
A short guide to transaction management in databases, covering the ACID properties, what each SQL isolation level actually prevents, and why transactions across microservices need sagas rather than a database guarantee.
6 min readEngineeringWhat is API integration? How it works and where it breaks
How API integration works: what it connects, the request and event styles behind it, how authentication and rate limits shape the design, and why a retry without an idempotency key is the usual point where it stops being reliable.
7 min read