Skip to main content
XenonStack

Kubernetes

XenonStack Blog Event-Driven Architecture: Patterns, Brokers, Trade-offs

and | Published | Updated

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.

SituationFits EDA?Reason (Microsoft guidance)
Several subsystems must process the same eventsYesEach subsystem gets an independent view of the event stream
Real-time processing with minimal lagYesConsumers respond as events occur
Pattern matching or time-window aggregationYesComplex event processing is a stated use case
High volume and velocity, such as IoTYesDesigned to be distributed and elastic
Simple request-response workflowsNoSynchronous calls already meet the need
Transactions needing strong consistency across servicesNoData is eventually consistent after publication
Team has not operated distributed asynchronous systemsNot yetOperational maturity is a stated pre-condition

What are the core building blocks?

Building blockWhat it does
Event producerCreates events and sends them to the channel; it knows what occurred but not who consumes it
Event channel or busReceives events from producers and delivers them to consumers, decoupling the two sides
Event consumerReacts to an event: updates a database or dashboard, sends an alert, starts new work or publishes a further event
Event logStores 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?

ModelHow it worksChoose it whenTypical service
Publish-subscribeInfrastructure tracks subscriptions and sends each event to every subscriber; no durable log, so new subscribers do not see past eventsYou need fan-out notification and do not need replayAzure Event Grid (per Microsoft)
Event streamingEvents are written to a durable log, ordered within a partition; clients read from any point and keep their own positionYou need replay, late-joining consumers or reprocessing after a bug fixAzure Event Hubs, Apache Kafka

How do the broker and mediator topologies differ?

TopologyStrengthRisk
BrokerHighly decoupled and dynamic; components broadcast events to the whole systemNo component owns or knows the state of a multistep business transaction, so distributed transactions are risky
MediatorA central mediator keeps state and handles error handling and restarts, giving more control and consistencyAdds 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.

BrokerWhat its own site saysBest fitWatch for
Apache KafkaThe 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 volumeStateful service, so operating it on Kubernetes needs planning
NATS JetStreamJetStream is the persistence layer: streams keep messages, consumers can replay from the start, a sequence number or a time, with at-least-once deliveryLightweight messaging with optional persistence and replayDocs describe at-least-once; plan idempotent consumers
KubeMQKubeMQ describes itself as Kafka-native messaging that keeps existing Kafka clients, built in Go and run on your own infrastructureTeams that want Kafka client compatibility on-premises or air-gappedPerformance 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.

Two-column diagram: guaranteed delivery to persist and acknowledge, duplicate processing to idempotent consumer, failed events to dead-letter queue, observability to correlation ID.
GuaranteeMeaningWhat you must do
At most onceThe producer sends the message and the consumer may or may not receive itAccept possible loss, or choose a different guarantee
At least onceThe consumer may receive duplicatesMake consumers idempotent (the Idempotent Consumer pattern)
Exactly onceEach message is processed one timeNeeds broker support plus idempotent processing; check your broker's documentation before relying on it
ChallengeRecommended practice (Microsoft guidance)
Guaranteed deliveryPersist in-transit events and remove them only when the next component acknowledges receipt
OrderingMultiple consumer instances can process events out of order; design for it where order matters
Error handlingUse an error-handler processor that resubmits or sends failed events to a dead-letter queue
ObservabilityPut a correlation ID in every event
Schema evolutionProducers and consumers deploy independently, so adopt a schema versioning strategy
Event granularityToo 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?

  1. Pick one business flow where several systems need the same event, not the whole estate.
  2. Decide pub/sub or streaming from your replay needs, then choose the broker.
  3. Define event schemas, a versioning rule and a correlation ID before the first producer ships.
  4. Make every consumer idempotent and add a dead-letter queue.
  5. Choose broker or mediator topology based on whether a multistep transaction needs a single owner.
  6. 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.

Table of Contents

navdeep-singh-gill

Navdeep Singh Gill

Global CEO and Founder of XenonStack

LinkedIn profile

Navdeep Singh Gill is serving as Chief Executive Officer and Product Architect at XenonStack. He holds expertise in building SaaS Platform for Decentralised Big Data management and Governance, AI Marketplace for Operationalising and Scaling. His incredible experience in AI Technologies and Big Data Engineering thrills him to write about different use cases and its approach to solutions.

Get the latest articles in your inbox

Subscribe Now

Interested in solving your challenges with the XenonStack team?
Get Started

Tell us about you and your priorities so we can prepare the right conversation. It takes about 2 minutes.

Please Select your Industry
Banking
Fintech
Payment Providers
Wealth Management
Discrete Manufacturing
Semiconductor
Machinery Manufacturing / Automation
Appliances / Electrical / Electronics
Elevator Manufacturing
Defense & Space Manufacturing
Computers & Electronics / Industrial Machinery
Motor Vehicle Manufacturing
Food and Beverages
Distillery & Wines
Beverages
Shipping
Logistics
Mobility (EV / Public Transport)
Energy & Utilities
Hospitality
Digital Gaming Platforms
SportsTech with AI
Public Safety - Explosives
Public Safety - Firefighting
Public Safety - Surveillance
Public Safety - Others
Media Platforms
City Operations
Airlines & Aviation
Defense Warfare & Drones
Robotics Engineering
Drones Manufacturing
AI Labs for Colleges
AI MSP / Quantum / AGI Institutes
Retail Apparel and Fashion

Continue