Dev tools

Event Driven Architecture: A Plain Guide

Event driven architecture explained: producers, brokers and consumers, the main patterns, event driven architecture examples, pros, cons and when to use it

By OmniAI Editorial · Nov 22, 2026 · 14 min read

Event driven architecture is a way of designing software where services communicate by publishing events, short records of something that happened, such as "order placed" or "payment failed," instead of calling each other directly. A producer announces the event, a broker or event channel carries it, and any number of consumers react to it on their own schedule. The result is loosely coupled systems that scale and evolve independently, at the cost of eventual consistency and harder debugging.

This plain guide explains what is event driven architecture in more detail, what is an event in event driven architecture, how it works, the main patterns, a step-by-step event driven architecture example, event driven architecture vs REST API calls, the tools people use, the benefits and challenges, and a checklist for when it's the right choice.

What Is Event Driven Architecture?

Microsoft's Azure Architecture Center describes the structure in three parts:

  • Event producers generate events when something changes.
  • Event channels, often an event broker or ingestion service, transfer events from producers to consumers.
  • Event consumers listen for events and react: updating a database, sending an email, starting a workflow, or publishing new events of their own.

The defining feature is decoupling. A producer doesn't know which consumers exist or what they'll do. You can add a new consumer, say a fraud check or an analytics pipeline, without changing the producer at all.

What Is an Event in Event Driven Architecture?

An event is a record of something that already happened, at a certain time: "Customer 4812 changed their email," "Sensor 9 reported 81°C," "Invoice 330 was paid." Three properties make events different from ordinary messages:

  • They describe the past. An event states a fact; it doesn't ask anyone to do anything. That's what separates an event from a command such as "send this email."
  • They are immutable. You never edit an event after publishing it. If something changes again, you publish a new event.
  • They have no single recipient. The producer publishes once, and every interested consumer gets it, including consumers added years later.

In practice, an event is a small message, usually JSON, with a type such as OrderPlaced, a unique ID, a timestamp, the source that produced it, and a payload with the relevant data or just the IDs consumers need to look it up.

How Event Driven Architecture Works

Two delivery models dominate, and Microsoft's guide distinguishes them clearly:

Publish-subscribeEvent streaming
How it worksThe broker tracks subscriptions and sends each event to every subscriberEvents are written to a durable, ordered log; consumers read from any position
After deliveryThe event isn't kept, so new subscribers don't see past eventsEvents stay for the retention period; consumers can replay
OrderingUsually not guaranteed across subscribersStrict within a partition
Typical toolsAmazon SNS and EventBridge, Azure Event Grid, Google Cloud Pub/Sub, RabbitMQ fanout exchangesApache Kafka, Amazon Kinesis, Azure Event Hubs, Redpanda
Best forNotifications and reactions to events as they happenData pipelines, analytics, replay and late-joining consumers

On the consumer side, processing ranges from simple to complex:

  • Simple event processing: an event immediately triggers an action, like a serverless function sending a receipt.
  • Event correlation: a consumer remembers earlier events and combines them by an ID, for example waiting for both "payment received" and "stock reserved" before shipping.
  • Complex event processing: detecting patterns across many events, such as a moving average crossing a threshold.
  • Event stream processing: continuous pipelines that transform and route streams, common in IoT and analytics.
A grey box with ink lines on the left, an ink arrow into a light horizontal channel, and three ink arrows out of the channel to three grey boxes, the middle box with an orange dot.
Producers publish events to a channel; any number of consumers react independently.

Event Driven Architecture Patterns

Martin Fowler pointed out in his article "What do you mean by Event-Driven?" that people use the term for four quite different patterns. Knowing which one you mean avoids a lot of confusion.

PatternWhat the event carriesStrengthTrade-off
Event notificationJust the fact that something changed, often with an IDVery low coupling; easy to add consumersThe overall flow isn't visible in any one place in the code
Event-carried state transferThe changed data itselfConsumers keep local copies and don't call the source; more resilientDuplicated data and more logic on the receiver
Event sourcingEvery state change, stored as the source of truthFull audit trail; rebuild past state; replayHarder schema changes and replays involving outside systems
CQRS (command query responsibility segregation)Separate models for writes and reads, often fed by eventsRead models tuned for queriesExtra complexity; not strictly about events

Two topologies sit on top of these patterns:

  • Broker topology (choreography): components broadcast events and others react, with no central coordinator. It's highly decoupled and scalable, but no component owns the state of a multi-step business process, so error handling needs careful design.
  • Mediator topology (orchestration): a central orchestrator receives events and sends commands to specific services, tracking the state of each process. It gives more control and better error handling at the cost of coupling and a potential bottleneck. The saga pattern, which coordinates multi-step transactions with compensating actions when a step fails, can use either style.

Event Driven Architecture Example: An Online Order

Here's an event driven architecture example step by step, for an online store:

  1. Checkout saves the order and publishes OrderPlaced with the order ID, customer ID, items and total.
  2. Payments consumes OrderPlaced, charges the card and publishes PaymentSucceeded or PaymentFailed.
  3. Inventory consumes OrderPlaced, reserves stock and publishes StockReserved or OutOfStock.
  4. Shipping waits for both PaymentSucceeded and StockReserved for the same order (event correlation), then creates a shipment and publishes OrderShipped.
  5. Notifications consumes PaymentSucceeded and OrderShipped and emails the customer.
  6. Analytics consumes everything into a data warehouse.
  7. If payment fails, Inventory consumes PaymentFailed and releases the reserved stock: a compensating action.

None of these services call each other. Adding a loyalty-points service next month means subscribing to PaymentSucceeded; nothing else changes.

A well-structured event, using the CloudEvents format, looks like this:

{
  "specversion": "1.0",
  "id": "a3f1c2e0-7b1d-4c8e-9a51-2f6d1c0b9e77",
  "source": "/checkout",
  "type": "com.example.order.placed",
  "time": "2026-11-22T09:15:00Z",
  "datacontenttype": "application/json",
  "data": { "orderId": "981", "customerId": "4812", "total": 42.50 }
}

CloudEvents is a CNCF specification for describing events in a common way; it graduated in the CNCF in January 2024. It requires four attributes, id, source, specversion and type, and the spec says producers must ensure source plus id is unique for each distinct event, which consumers can use to detect duplicates.

Event Driven Architecture vs REST API Calls

In a request driven (request-response) design, such as one service calling another's REST API, a service calls another and waits for the answer, usually over REST or gRPC. In an event driven design, a service announces what happened and moves on.

Request drivenEvent driven
CommunicationSynchronous call and responseAsynchronous publish and react
CouplingCaller knows the callee and its APIProducer doesn't know who consumes
Failure impactIf the callee is down, the caller fails or waitsEvents wait in the broker until consumers recover
ConsistencyImmediate, within the callEventual: services catch up over time
Adding new behaviorChange the caller to make another callAdd a new consumer
DebuggingFollow one call stackTrace events across services with correlation IDs
Best forQueries and actions needing an immediate answerWorkflows, notifications, integrations, pipelines

Most real systems use both: synchronous APIs for reads and actions the user waits on, events for everything that can happen afterward. Our comparison of webhook vs API covers one common way events cross company boundaries.

A dotted ink border around a grey database cylinder and a light table with ink lines, and an ink arrow from the border to a light channel holding three blocks, the first one orange.
The outbox pattern saves the data and the event in one transaction, then publishes the event.

Event Driven Architecture Tools

CategoryExamplesUse
Event streaming platformsApache Kafka, Redpanda, Amazon Kinesis, Azure Event HubsHigh-volume, replayable event logs
Message brokersRabbitMQ, ActiveMQ, NATSRouting and queuing events and commands
Cloud event routersAmazon EventBridge, Azure Event Grid, Google EventarcRouting events between cloud services and SaaS apps
Cloud pub/subAmazon SNS, Google Cloud Pub/SubFan-out to many subscribers
StandardsCloudEvents (event format), AsyncAPI (describing event APIs)Interoperability and documentation
Workflow and orchestrationTemporal, AWS Step FunctionsCoordinating long-running, multi-step processes

Choosing between a broker and a log is often the first decision. Our guides to the message queue and Kafka vs RabbitMQ cover that choice in depth.

How to Design Good Events

Events are a contract between teams, so design them as carefully as an API.

  • Name them in the past tense, after business facts: OrderPlaced, InvoicePaid, SubscriptionCancelled. Events describe what happened; commands like ShipOrder ask for something to happen and usually go to one specific service.
  • Decide how much data to include. Microsoft's guide describes two approaches. Putting all needed attributes in the payload lets consumers act without querying anything, but larger events cost more bandwidth, duplicate data across systems and make versioning harder. Putting only keys in the payload keeps one system of record and simpler contracts, but every consumer has to query the source for details. Many teams include the key fields most consumers need and an ID for the rest.
  • Include metadata: a unique event ID, the time it happened, the source, the event type and version, and a correlation ID that ties related events together.
  • Version deliberately: add optional fields rather than renaming or removing them, and publish a new event type when the meaning changes.
  • Document event APIs: the AsyncAPI specification does for events what OpenAPI does for REST endpoints, listing channels, message formats and examples.

Testing Event Driven Systems

Testing changes when services don't call each other directly.

  • Unit test handlers with sample events, including duplicates and out-of-order arrivals.
  • Contract test event schemas so a producer can't publish a change that breaks known consumers.
  • Integration test with a real broker running locally or in a test environment, checking that events flow end to end and land in the right state.
  • Test failure paths: consumer crashes mid-processing, broker restarts, poison messages that should end up in a dead-letter queue.
  • Assert eventually, not immediately: wait for the expected state with a timeout instead of checking right after publishing.

Event Driven Architecture and AI Systems

Events fit AI workloads well because model calls are slow, expensive and fail more often than ordinary functions. A support ticket created in a help desk can publish an event that triggers an AI classifier, which publishes TicketClassified for routing; a document upload can trigger embedding and indexing for retrieval; an AI agent can subscribe to events from business systems and act when something happens, rather than polling. Queuing model work behind events also smooths spikes and makes retries and rate limits easier to manage.

Benefits of Event Driven Architecture

  • Loose coupling: services evolve, deploy and scale independently.
  • Easy extension: new consumers plug in without touching producers.
  • Resilience: if a consumer is down, events wait; the producer keeps working.
  • Real-time reactions: consumers act as soon as events occur.
  • Scalability: consumers scale horizontally to match event volume.
  • Audit and replay: with event streaming or event sourcing, you keep a history you can reprocess after a bug fix or to build a new feature.

Challenges and How to Handle Them

ChallengeWhy it happensHow to handle it
Eventual consistencyConsumers update at their own paceDesign user interfaces and reads to tolerate brief staleness; use synchronous calls where strong consistency is essential
Duplicate eventsMost brokers deliver at least onceMake consumers idempotent; use event IDs to skip duplicates
OrderingParallel consumers process events out of orderPartition by a key such as order ID; include sequence numbers or versions
Lost events at publish timeThe database write succeeds but the publish fails, or the reverseUse the transactional outbox pattern: write the event to an outbox table in the same transaction, then publish from there
Error handlingNo caller waits to handle the failureRetries with backoff, dead-letter queues, compensating actions
ObservabilityOne business transaction spans many servicesPut a correlation ID in every event and use distributed tracing
Schema evolutionProducers and consumers deploy separatelyVersion events, only add optional fields, use a schema registry
Event overloadToo many fine-grained eventsPublish meaningful business events, not every database change
Data exposureEvents are visible to many componentsLeave sensitive data out of events or encrypt it

When to Use Event Driven Architecture

Microsoft's architecture guide lists conditions where the style fits, and where it doesn't. Turned into a checklist:

Good fit when:

  • Several subsystems must react to the same events.
  • You need near real-time processing.
  • You need pattern detection or aggregation over time windows.
  • Event volume and speed are high, such as IoT or clickstreams.
  • Teams need to deploy and scale producers and consumers independently.

Poor fit when:

  • Workflows are simple request-response and synchronous calls meet your needs.
  • Business transactions require strong consistency across services at every moment.
  • Your team has no experience running distributed, asynchronous systems; debugging, monitoring and recovery work very differently.

A practical path: start with a well-structured application that uses synchronous calls, and introduce events where they clearly help, such as sending notifications, syncing data to analytics, or integrating a new service without touching existing ones.

Common Mistakes

  • Using events for everything. Queries that need an answer now belong in an API call.
  • Publishing database changes instead of business events. RowUpdated tells consumers little; OrderCancelled tells them what happened.
  • Ignoring duplicates and order. Assume both will happen.
  • Skipping the outbox. Saving data and publishing an event as two separate steps eventually loses one of them.
  • No correlation IDs. Without them, tracing a failed order across five services is guesswork.
  • Breaking event schemas. Removing or renaming fields breaks consumers you may not know exist.

FAQ

What is event driven architecture in simple terms?

It's a design where parts of a system tell each other when something happens, by publishing events, instead of calling each other and waiting. Other parts listen and react in their own time.

What is an example of event driven architecture?

An online store where checkout publishes "order placed," and separate services for payments, inventory, shipping, email and analytics each react to it, without checkout calling any of them directly.

Is Kafka an event driven architecture?

Kafka is a tool, not an architecture. It's an event streaming platform that is commonly used as the event channel in an event driven architecture, especially when you need durable, replayable event streams.

What is the difference between event driven and microservices?

Microservices describes how you split an application into small, independently deployed services. Event driven architecture describes how components communicate. Many microservice systems use events, but microservices can also talk through synchronous APIs.

What are the disadvantages of event driven architecture?

Eventual consistency, duplicate and out-of-order events, harder debugging across services, schema evolution and the operational work of running brokers. Good practices like idempotent consumers, correlation IDs and the outbox pattern handle most of them.

All articles

Read next

Language

EnglishEnglish · en TürkçeTurkish · tr DeutschGerman · de العربيةArabic · ar

Account

Enter your email. We’ll send you a sign-in link and a 6-digit code. No password needed.

Sign in

Theme

Language

Show our email address

To keep spam out of our inbox, please confirm your own email first. We will send you a 6-digit code.

We send codes only to these providers: gmail.com, googlemail.com, outlook.com, hotmail.com, live.com, msn.com, proton.me, protonmail.com, pm.me, icloud.com, me.com, mac.com, yahoo.com, aol.com, gmx.de, gmx.net, web.de, t-online.de, yandex.com, omniai.blog