Key takeaway
- Event-driven architecture for CTOs and architects: when it fits, pub/sub vs streaming, Kafka, NATS and KubeMQ, delivery guarantees and trade-offs.
Event-driven architecture (EDA) is an architecture in which event producers publish events, event consumers react to them, and an event channel such as a broker carries events between the two. Events arrive in near real time and producers do not know who is listening. For microservices this removes point-to-point integrations: a new consumer can be added without changing the producer or any other consumer.
This guide is for CTOs, enterprise architects and platform leads deciding where EDA fits. It covers when to use it, the broker options (Kafka, NATS and KubeMQ), delivery guarantees, topologies, and the cases where a simpler synchronous design is the better choice. For the cloud-native setting around it, see our guide to cloud native architecture patterns.
What is event-driven architecture and when does it fit?
According to the Microsoft Azure Architecture Center, an event-driven architecture has three parts: producers that generate a stream of events, consumers that listen for them, and event channels (often brokers or ingestion services) that transfer events from producers to consumers. Its benefits are decoupling, no point-to-point integrations, immediate reaction to events, and scale and elasticity.
| Situation | Fits EDA? | Reason (Microsoft guidance) |
|---|---|---|
| Several subsystems must process the same events | Yes | Each subsystem gets an independent view of the event stream |
| Real-time processing with minimal lag | Yes | Consumers respond as events occur |
| Pattern matching or time-window aggregation | Yes | Complex event processing is a stated use case |
| High volume and velocity, such as IoT | Yes | Designed to be distributed and elastic |
| Simple request-response workflows | No | Synchronous calls already meet the need |
| Transactions needing strong consistency across services | No | Data is eventually consistent after publication |
| Team has not operated distributed asynchronous systems | Not yet | Operational maturity is a stated pre-condition |
What are the core building blocks?
| Building block | What it does |
|---|---|
| Event producer | Creates events and sends them to the channel; it knows what occurred but not who consumes it |
| Event channel or bus | Receives events from producers and delivers them to consumers, decoupling the two sides |
| Event consumer | Reacts to an event: updates a database or dashboard, sends an alert, starts new work or publishes a further event |
| Event log | Stores events durably so a system can rebuild its state by replaying them |
Event processing is simple or complex. Simple event processing handles events that are independent of other events, for example enriching a payload, changing its schema or routing it to another stream. Complex event processing applies conditions over a set of events to derive a new compound event, for example detecting a pattern across several sources.
Pub/sub or event streaming: which messaging model do you need?
| Model | How it works | Choose it when | Typical service |
|---|---|---|---|
| Publish-subscribe | Infrastructure tracks subscriptions and sends each event to every subscriber; no durable log, so new subscribers do not see past events | You need fan-out notification and do not need replay | Azure Event Grid (per Microsoft) |
| Event streaming | Events are written to a durable log, ordered within a partition; clients read from any point and keep their own position | You need replay, late-joining consumers or reprocessing after a bug fix | Azure Event Hubs, Apache Kafka |
How do the broker and mediator topologies differ?
| Topology | Strength | Risk |
|---|---|---|
| Broker | Highly decoupled and dynamic; components broadcast events to the whole system | No component owns or knows the state of a multistep business transaction, so distributed transactions are risky |
| Mediator | A central mediator keeps state and handles error handling and restarts, giving more control and consistency | Adds coupling; the mediator can become a bottleneck or a reliability concern |
Which message broker should you use: Kafka, NATS or KubeMQ?
All EDA implementations need a message or event broker in the middle. Compare the three options named in our earlier guide against their own current documentation.
| Broker | What its own site says | Best fit | Watch for |
|---|---|---|---|
| Apache Kafka | The Kafka 4.0 documentation states that in KRaft mode Kafka eliminates its dependency on ZooKeeper (the Kafka documentation is the source for version-specific behaviour) | Durable, replayable streams at high volume | Stateful service, so operating it on Kubernetes needs planning |
| NATS JetStream | JetStream is the persistence layer: streams keep messages, consumers can replay from the start, a sequence number or a time, with at-least-once delivery | Lightweight messaging with optional persistence and replay | Docs describe at-least-once; plan idempotent consumers |
| KubeMQ | KubeMQ describes itself as Kafka-native messaging that keeps existing Kafka clients, built in Go and run on your own infrastructure | Teams that want Kafka client compatibility on-premises or air-gapped | Performance figures on its site are vendor benchmarks; test with your own load |
Earlier versions of this guide quoted container sizes and a benchmark for these brokers. We have removed them because they could not be verified against current vendor documentation.
What are the delivery guarantees and where does EDA get hard?
The Azure guidance lists the main challenges: guaranteed delivery, ordering, duplicate processing, eventual consistency, error handling, observability and schema evolution. Delivery is described in three levels.
| Guarantee | Meaning | What you must do |
|---|---|---|
| At most once | The producer sends the message and the consumer may or may not receive it | Accept possible loss, or choose a different guarantee |
| At least once | The consumer may receive duplicates | Make consumers idempotent (the Idempotent Consumer pattern) |
| Exactly once | Each message is processed one time | Needs broker support plus idempotent processing; check your broker's documentation before relying on it |
| Challenge | Recommended practice (Microsoft guidance) |
|---|---|
| Guaranteed delivery | Persist in-transit events and remove them only when the next component acknowledges receipt |
| Ordering | Multiple consumer instances can process events out of order; design for it where order matters |
| Error handling | Use an error-handler processor that resubmits or sends failed events to a dead-letter queue |
| Observability | Put a correlation ID in every event |
| Schema evolution | Producers and consumers deploy independently, so adopt a schema versioning strategy |
| Event granularity | Too many fine-grained events overwhelm the system; too few cause unnecessary processing |
A common way to describe events across services is CloudEvents, a specification for describing event data in a common way. It is a graduated project of the Cloud Native Computing Foundation (approved 25 January 2024).
How does EDA work with microservices, Kubernetes and serverless?
Microservices built around events react to what happens rather than being called directly, so each service can be changed, deployed and scaled on its own. On Kubernetes this combines a broker with event-based scaling: our guide on KEDA for serverless, event-driven containers shows how workloads scale from event sources, and our AWS serverless computing guide covers the managed-service route. For platform groundwork, see Kubernetes deployment tools and best practices.
Governance matters as events begin to trigger automated decisions. ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents, and the Exception Handling Agent routes every edge case to the right person with full context and evidence. For operations, AgentSRE uses a fleet of AI agents to automate detection, root cause analysis and remediation.
What is the adoption sequence?
- Pick one business flow where several systems need the same event, not the whole estate.
- Decide pub/sub or streaming from your replay needs, then choose the broker.
- Define event schemas, a versioning rule and a correlation ID before the first producer ships.
- Make every consumer idempotent and add a dead-letter queue.
- Choose broker or mediator topology based on whether a multistep transaction needs a single owner.
- Add monitoring of lag, failures and replays, then expand to the next flow.
When should you not use event-driven architecture?
Keep to synchronous calls where a request-response workflow is enough, where a business transaction needs strong consistency across services, or where the team has not yet run distributed asynchronous systems. In those cases the extra moving parts add cost without a matching benefit.
To map one decision your agents should make from an event, and the context and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is event-driven architecture?
It is an architecture in which event producers publish a stream of events, event consumers react to them, and event channels such as brokers carry events between the two. Producers do not know which consumers are listening.
What is the difference between pub/sub and event streaming?
In publish-subscribe the messaging infrastructure sends each event to every current subscriber and does not keep a durable log, so new subscribers do not see past events. In event streaming events are written to a durable log, ordered within a partition, and clients can replay from any point.
Does event-driven architecture guarantee exactly-once processing?
Not by itself. Delivery is usually at-least-once, so consumers should be idempotent. Microsoft's guidance names the Idempotent Consumer pattern as the mitigation for duplicate processing.
When should I not use event-driven architecture?
Avoid it for simple request-response workflows that synchronous calls already meet, for business transactions that need strong consistency across services, and where the team has no experience of operating distributed asynchronous systems.
Which message broker should I choose: Kafka, NATS or KubeMQ?
Choose by the replay and ordering you need, your operating capacity and your platform. Kafka stores events in replicated topics, NATS JetStream adds persistence and replay to a lightweight server, and KubeMQ positions itself as Kafka-compatible messaging you run on your own infrastructure.
What is the difference between the mediator and broker topologies?
In the broker topology components broadcast events with no central owner, which is highly decoupled but leaves no component aware of a multistep transaction. In the mediator topology a central mediator holds state and handles errors and restarts, which gives control but can become a bottleneck.
Follow XenonStack on LinkedIn: XenonStack on LinkedIn for new guides on agentic AI, data and platform engineering.
Ready to put AI agents to work? Explore ElixirClaw, the agentic OS platform to build, orchestrate and govern AI agents.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE