Event Hubs in Azure: The Wide River That Carries Millions of Events Every Second
An intermediate, plain-English guide to Azure Event Hubs — how huge streams of telemetry and logs are ingested, split across partitions, read by many independent consumers, archived automatically and analysed in real time, plus how to size, secure, monitor and pay for it sensibly.
Imagine a motorway with many lanes. Thousands of cars join it every minute from different slip roads, each lane carries its own steady flow, and at the other end several toll stations and traffic cameras watch the traffic for their own purposes. None of them slows the others down, and the road keeps a short memory of what passed in case a camera needs to look back. Azure Event Hubs is that motorway for data. Applications, devices and services pour in small records at enormous volume, the records are spread across lanes called partitions, and many separate readers consume the flow independently and at their own pace.
In this guide we will go step by step through what the service is, how its parts fit together, how an event travels from a producer to a consumer, why partitions and consumer groups matter so much, and how to design, secure, scale, monitor and pay for a streaming pipeline. We will also compare it honestly with its neighbours, Event Grid and Service Bus, and with Apache Kafka, because choosing the right tool is half of the design.
1What Event Hubs Is and Why It Exists
Some data does not arrive in tidy envelopes. It arrives in floods.
Think about what modern systems produce: clicks on a website, readings from thousands of sensors, application logs, financial ticks, vehicle positions and game actions. A single reading is tiny, but together they can number millions per second, and they never stop. Ordinary databases and queues are not designed to absorb that kind of continuous torrent and let many different programs read it at once.
Azure Event Hubs is a fully managed, real-time data ingestion service built for exactly this. It accepts huge volumes of events from many producers, stores them temporarily in an ordered log, and lets any number of consumers read them independently. You do not manage servers, brokers or clusters. You create an event hub, send data to it and attach readers.
Its purpose is to be the front door for streaming data. It decouples the systems that produce data from the systems that analyse, store or react to it. Producers can send at full speed without waiting for slow consumers, and consumers can be added, removed or replayed without producers knowing.
Think of a wide river rather than a pipe. Rain falls on thousands of fields and streams, and all of it flows into the river. Along the banks, a water company, a hydropower plant and a flood-warning team each draw what they need without affecting one another. The river holds the water for a while as it passes, but it does not store it forever.
An event log, not a mailbox
The key idea is that Event Hubs keeps events in an append-only log. Consumers do not remove events when they read them. They simply remember how far they have read. This is very different from a traditional queue, where reading a message takes it away. In a log, ten different consumers can read the same events, and a consumer that fell behind or crashed can go back and read again, as long as the events are still within the retention period.
2The Big Picture: Event Hubs Among the Azure Messaging Services
Choosing the right messaging service starts with the nature of what you are sending.
Azure has three well-known messaging services, and beginners often confuse them. Each is built for a different job, and good architectures often use more than one together.
| Service | Built for | Reading model | Typical example |
|---|---|---|---|
| Event Hubs | High-volume streams of telemetry, logs and clickstreams | Consumers read a retained log at their own position | Millions of sensor readings flowing into analytics |
| Event Grid | Discrete notifications that something happened, routed to many handlers | Events pushed or pulled to subscribers, no long-term log | A new file triggers a function |
| Service Bus | Reliable business messaging with queues, ordering, sessions and transactions | Messages are consumed and removed after processing | Order processing where each order must be handled once |
flowchart TD
A["What are you moving?"] --> B{"Continuous high-volume stream to be analysed or replayed?"}
B -->|"Yes"| EH["Event Hubs"]
A --> C{"A notification that something happened?"}
C -->|"Yes, react to it"| EG["Event Grid"]
A --> D{"A command or work item needing reliable single processing?"}
D -->|"Yes"| SB["Service Bus"]
EG -.->|"Can deliver into"| EH
EG -.->|"Can deliver into"| SB
EH -.->|"Capture to storage"| ST["Blob storage or data lake"]
Event Hubs and Apache Kafka
Apache Kafka is a popular open-source platform for the same kind of streaming workload, and many organisations already run it. Event Hubs can speak the Kafka protocol, so existing Kafka producers and consumers can connect to an event hub by changing configuration rather than rewriting code. This lets teams keep their Kafka tools while handing the operation of the platform to Azure. It is not a complete copy of every Kafka feature, so check that the features you depend on are supported.
Event Hubs is the motorway that carries every vehicle past many observers. Event Grid is the doorbell that tells you one particular visitor arrived. Service Bus is the registered post that must be signed for and handled exactly once. Three different needs, three different tools.
If you need to read the same data several times, by several systems, or replay it after a failure, think Event Hubs. If you need each item handled once and then gone, think Service Bus. If you only need to react to an occurrence, think Event Grid.
3Core Concepts You Must Know
A short vocabulary unlocks every screen, metric and design conversation.
Event Hubs has a compact set of terms. Spending a few minutes here saves hours of confusion later.
Event
A small record of something that happened: a reading, a click, a log line. It has a body of data, optional properties and system metadata.
Namespace
The top-level container that holds one or more event hubs and defines the pricing tier, capacity, network and security settings.
Event hub
One stream of events inside a namespace. Roughly equivalent to a topic in Kafka.
Partition
An ordered lane of events within an event hub. Partitions allow many readers and writers to work in parallel.
Partition key
A value supplied by the producer that decides which partition an event goes to, so related events stay together and in order.
Offset and sequence number
Markers that identify an event’s position within a partition. Consumers use them to know where they are.
Producer
Any application or device that sends events to an event hub.
Consumer and consumer group
A consumer reads events. A consumer group is a named, independent view of the stream, so different applications each keep their own position.
Checkpoint
A saved record of how far a consumer has processed, so it can resume after a restart without starting over.
Retention
How long events are kept in the hub before they expire. After that they can no longer be read.
Capacity units
The measure of how much traffic a namespace can handle: throughput units, processing units or capacity units depending on the tier.
Capture
A built-in feature that automatically copies the stream into storage files for long-term keeping and batch analysis.
A namespace is a whole motorway authority. An event hub is one motorway. Partitions are its lanes, and the partition key is the sign that sends all vehicles from one company into the same lane. A consumer group is one observer with their own notebook recording the last number plate they noted, and the checkpoint is that note.
People often think reading an event deletes it, as in a queue. It does not. Events stay until retention expires, no matter how many consumers have read them. This is what makes replay and multiple independent readers possible.
4Architecture, Components and Tiers
What Azure runs, what you configure and how the tiers differ.
Event Hubs is a managed service, so the brokers, storage, replication and failure handling behind it are Azure’s job. Your decisions concern the namespace, the event hubs inside it, the number of partitions, the retention period, the tier and the clients that send and receive.
| Component | Responsibility | Who operates it |
|---|---|---|
| Namespace | Container with tier, capacity, networking, identity and encryption settings | You configure, Azure hosts |
| Event hubs | Individual streams with partition count and retention | You configure, Azure hosts |
| Partitioned log storage | Stores events durably in order within each partition | Azure |
| Producers | Send events using protocols such as AMQP, HTTPS or Kafka | You build |
| Consumers and processors | Read events by consumer group and keep checkpoints | You build, with client libraries |
| Checkpoint store | Holds consumer progress, commonly a storage account | You provide |
| Capture | Writes the stream to storage files automatically | Azure, you choose destination |
| Schema Registry | Central place to store and version the structure of events | Azure, you manage schemas |
The tiers
| Tier | Capacity model | Good for | Notes |
|---|---|---|---|
| Basic | Throughput units | Development, small and simple workloads | Short retention and a limited feature set, without features such as Capture or the Kafka endpoint |
| Standard | Throughput units, with optional auto-inflate | Most production workloads | Adds more consumer groups, Capture and Kafka compatibility, with longer retention than Basic |
| Premium | Processing units, with resource isolation | Demanding workloads needing predictable performance and security features | Longer retention, dynamic partition scaling and geo-replication |
| Dedicated | Capacity units in a single-tenant cluster | The largest and most isolated workloads | Reserved cluster with its own capacity, billed hourly with a minimum commitment |
Retention limits, number of partitions, consumer groups and which features each tier includes change over time. Confirm the current limits in the official documentation before choosing a tier or promising a feature to your team.
Basic is meant for experiments. Its feature limits, such as no Capture and restricted consumer groups, tend to surprise teams that start there and later need those features.
5Internal Working: The Life of One Event
From a sensor reading to an analytics dashboard.
Following one event through the system explains partitions, offsets, consumer groups and checkpoints in a single story.
flowchart LR
P1["Producer A"] --> HUB
P2["Producer B"] --> HUB
P3["Producer C"] --> HUB
subgraph HUB["Event hub with four partitions"]
PA["Partition 0"]
PB["Partition 1"]
PC["Partition 2"]
PD["Partition 3"]
end
PA --> CG1["Consumer group: analytics"]
PB --> CG1
PC --> CG1
PD --> CG1
PA --> CG2["Consumer group: archiving"]
PB --> CG2
PC --> CG2
PD --> CG2
A producer creates and batches events
Producers usually group many small events into a batch to reduce network overhead before sending, which greatly improves throughput.
The service chooses a partition
If a partition key is given, a stable calculation maps that key to one partition. Without a key, events are spread across partitions to balance load.
The event is appended and stored durably
The event is added to the end of that partition’s log, receives an offset and sequence number and is replicated within the service for durability before the producer is told it succeeded.
Consumers read from their position
Each consumer group has its own position in every partition. Readers fetch events after that position, in order, without affecting other groups.
Processing and checkpointing
After handling a batch of events, the consumer saves a checkpoint to its checkpoint store. If it crashes, a replacement resumes from the last checkpoint.
Retention expires old events
When an event is older than the retention period, it is removed. Consumers that never caught up lose the chance to read it, which is why monitoring lag matters.
sequenceDiagram
participant Prod as Producer
participant EH as Event hub partition
participant Proc as Event processor
participant CP as Checkpoint store
Prod->>EH: Send batch of events
EH-->>Prod: Acknowledge stored
Proc->>CP: Where did I stop last time?
CP-->>Proc: Last checkpoint position
Proc->>EH: Read events after that position
EH-->>Proc: Events in order
Proc->>Proc: Process events
Proc->>CP: Save new checkpoint
Batch aggressively when sending, and checkpoint thoughtfully when reading. Sending one event per call wastes throughput, and checkpointing after every single event wastes storage calls. Checkpoint every few seconds or every batch instead.
6Partitions: The Heart of Scale and Ordering
Almost every Event Hubs design question comes back to partitions.
A single lane can carry only so much traffic and be read by only one reader at a time within a consumer group. Partitions solve both problems by splitting the stream into several lanes that can be written and read in parallel. They are also the unit of ordering, which creates important trade-offs.
What partitions give you
Parallel writes
Many producers write to different partitions at once, so the hub as a whole absorbs far more than one lane could.
Parallel reads
Within a consumer group, different readers can each take different partitions, scaling out processing.
Order within a lane
Events in one partition are kept in the order they arrived, which preserves the sequence of related events.
No global order
There is no ordering guarantee between different partitions. Only events within the same partition are ordered.
Choosing the number of partitions
The partition count sets the ceiling for read parallelism: a consumer group can have at most one active reader per partition. It also bounds how much traffic the hub can take. Choose it based on peak throughput and the number of parallel consumers you will want in future. In some tiers the count can be changed later, but in others it is fixed at creation, and increasing it can change which partition a given key maps to. Check the rules of your tier, and leave headroom for growth.
Choosing partition keys
Use a key when order per entity matters
Using a device identifier or customer identifier as the key keeps all events for that device or customer in one partition, in order.
Avoid keys when order does not matter
If events are independent, letting the service spread them evenly gives the best balance across partitions.
Beware of hot partitions
If one key is far busier than others, its partition becomes a bottleneck while the others sit idle. Choose keys with many evenly used values.
Think of supermarket checkout lanes. If every customer with a trolley is sent to lane three, lane three jams while the others stand empty. Sending customers evenly across lanes keeps everyone moving, but then you cannot guarantee that a particular family is served in a particular order.
Choosing too few partitions and discovering later that you cannot add more readers, or too many without reason and wasting resources. Plan for realistic peak load and parallelism rather than guessing wildly in either direction.
7Consumers, Consumer Groups and Checkpointing
Many readers, each with their own bookmark.
The ability for many independent applications to read the same stream is a defining feature. It is achieved through consumer groups and carefully managed positions.
Consumer groups
A consumer group is a named view of the whole event hub. Each group keeps its own position in each partition. An analytics application, an archiving process and a fraud detector can each use their own group, and each will see every event, at its own pace. Applications that need to share the work of one task, such as a fleet of identical workers, belong to the same group.
The event processor pattern
Writing a reliable reader by hand is difficult, so client libraries provide an event processor. It coordinates several instances of your application so that partitions are shared among them, balances ownership automatically when instances join or leave, reads events in batches and records checkpoints in a storage account. Using it is the standard approach for production consumers.
flowchart TD
subgraph HUB["Event hub with four partitions"]
P0["Partition 0"]
P1["Partition 1"]
P2["Partition 2"]
P3["Partition 3"]
end
subgraph G1["Consumer group: orders-analytics with two instances"]
I1["Instance 1"]
I2["Instance 2"]
end
P0 --> I1
P1 --> I1
P2 --> I2
P3 --> I2
I1 --> CK["Checkpoint store in storage account"]
I2 --> CK
Delivery guarantees you should expect
Event Hubs consumers generally operate with at-least-once processing. If a consumer processes events but crashes before saving its checkpoint, the replacement will read those events again. Your processing must therefore tolerate seeing the same event twice. Making handlers idempotent, so that repeating an action does not change the result, is the standard answer.
Advantages of this read model
- Many independent applications read the same data
- Crashed consumers resume from their last checkpoint
- New consumers can start from the beginning of retained data
- Scaling out is as simple as adding instances
Things to handle carefully
- Duplicates after a crash between processing and checkpointing
- No more active readers in a group than partitions
- Falling behind past retention loses events
- A slow consumer in a group delays its own partitions only
A consumer group is a book club that reads the same book as every other book club, with a bookmark of its own. If a member loses their place, they check the club’s shared notebook, which is the checkpoint store, and carry on from the last page recorded.
If two unrelated applications use the same consumer group, they will fight over partitions and each will see only part of the data. Give every distinct application its own group.
8Protocols and Kafka Compatibility
Speak whichever language your existing tools already know.
Event Hubs supports several ways for applications to connect, and the choice affects both effort and capability.
| Protocol | Strengths | Typical use |
|---|---|---|
| AMQP | Efficient, persistent connections with full feature support | Native Azure client libraries in several programming languages |
| Kafka protocol | Lets existing Kafka clients connect with configuration changes only | Migrating Kafka workloads and using Kafka ecosystem tools |
| HTTPS | Simple, works almost anywhere, including restricted environments | Occasional senders and devices that cannot hold connections |
Why Kafka compatibility matters
Many companies have years of investment in Kafka producers, consumers, connectors and stream-processing frameworks. The Kafka endpoint on Event Hubs lets those applications talk to a managed service without rewriting them. In simple terms, a Kafka topic corresponds to an event hub, a Kafka consumer group to an Event Hubs consumer group, and Kafka offsets to Event Hubs offsets. This can remove the operational burden of running and patching Kafka clusters.
Move existing Kafka applications
Point clients at the Event Hubs endpoint and adjust authentication settings. Many applications run with little or no code change.
Keep using Kafka tooling
Connectors and stream-processing frameworks written for Kafka can often continue to work against the compatible endpoint.
Know the differences
Not every Kafka feature or administrative operation is supported, and some behaviours differ in detail. Test your specific application and read the compatibility notes before committing.
The Kafka endpoint requires a tier above Basic. Make sure your chosen tier includes it before planning a migration.
Kafka compatibility is like a travel adaptor. Your existing appliance keeps its original plug, and the socket on the wall accepts it. Most appliances work fine, though the odd one with special requirements needs a closer look.
9Capture and Downstream Processing
An ingestion service is only useful if something valuable happens afterwards.
Event Hubs deliberately keeps data only for a limited retention period. Real solutions send it onward to places where it can be analysed, stored or acted on. Fortunately, the service integrates with many other tools.
Capture
Automatically writes events to Blob storage or a data lake in files, on a time or size window, with no code. Ideal for long-term retention and batch analysis.
Stream Analytics
Run continuous queries over the stream to filter, aggregate over time windows and write results to dashboards or stores.
Azure Functions
Trigger code on incoming batches for lightweight, event-by-event reactions.
Spark-based platforms
Use structured streaming on analytics platforms to process very large streams with rich transformations.
Fabric and Data Explorer
Stream data into real-time analytics and query it interactively, with growing integration with Microsoft Fabric.
Your own consumers
Applications using the client libraries or Kafka clients for specialised logic.
flowchart LR
S["Devices, apps and logs"] --> EH["Event Hubs"]
EH --> CAP["Capture to data lake"]
EH --> SA["Stream Analytics"]
EH --> FN["Azure Functions"]
EH --> SP["Spark streaming"]
EH --> RT["Real-time analytics"]
CAP --> BATCH["Batch analytics and long-term storage"]
SA --> DASH["Live dashboards"]
FN --> ACT["Alerts and actions"]
SP --> ML["Machine learning features"]
Hot path and cold path
A common design splits processing into two paths. The hot path reacts within seconds, using stream processing for alerts and live dashboards. The cold path keeps everything cheaply for later, using Capture to store raw events for batch analysis, reprocessing and audit. Using both gives you immediate insight and a durable record from the same single stream.
Because retention is limited, enable Capture on important hubs. If a downstream system has a bug, you can rebuild its results from the archived files rather than losing history.
Capture writes files by time and size windows. Very short windows on low traffic produce huge numbers of tiny files, which slows later analysis. Choose windows that produce reasonably sized files.
10Schemas and Designing Good Events
A stream with many readers is a contract with strangers.
When one producer sends data that ten different teams read, the structure of that data becomes a shared agreement. Change it carelessly and ten applications break in different ways, often silently.
Schema Registry
The Schema Registry feature gives you a central place to store the definitions of your event structures, usually in formats such as Avro and, in more recent updates, others such as JSON Schema. Producers reference a schema by identifier rather than embedding it in every event, which saves space. Consumers look up the schema to interpret the data. The registry can also enforce compatibility rules, so that a new version of a schema cannot be published if it would break existing readers.
Practical design advice
Keep events small and self-describing
Include an identifier, a timestamp and the type of event, and keep the body to what is needed. Large events reduce throughput and increase cost.
Choose an efficient format
Compact binary formats are cheaper and faster than verbose text for high volumes. Text formats are easier to debug, so weigh convenience against cost.
Evolve schemas safely
Add optional fields rather than changing or removing existing ones, and use compatibility checks to catch mistakes before they reach production.
Include time carefully
Distinguish when an event happened from when it was received. Late and out-of-order data is normal in streaming, and analysis should use event time where accuracy matters.
Respect size limits
Individual events and batches have maximum sizes. Check the current limits and design large payloads, such as images, to be stored elsewhere with the event carrying only a reference.
A schema is like the agreed format of a delivery form used by many shops and many couriers. If one shop silently changes the layout, every courier’s scanner reads it wrongly. A registry is the notice board where any proposed change must be approved first.
Events may be read by many consumers and copied into archives. Avoid placing passwords, tokens or unnecessary personal data in them, and mask or tokenise sensitive fields before sending.
11Scaling and Capacity
Capacity is a shared budget, and exceeding it means being throttled.
Each tier measures capacity in its own units, which define how much data can flow in and out. When traffic exceeds the allowed rate, the service slows down or rejects requests, a behaviour called throttling. Producers and consumers must be ready for it.
| Unit | Tier | What it controls |
|---|---|---|
| Throughput unit | Basic and Standard | A fixed allowance of ingress and egress per unit, shared by all event hubs in the namespace |
| Processing unit | Premium | Isolated compute and storage resources giving more predictable performance |
| Capacity unit | Dedicated | A share of a single-tenant cluster reserved for you |
Ways to scale
Add capacity units
Increase throughput or processing units manually when traffic grows.
Auto-inflate
On supported tiers, let the namespace raise throughput units automatically up to a maximum you set, protecting against surprise spikes.
More partitions
Where the tier allows it, increase partitions to raise parallelism, mindful of the effect on key-to-partition mapping.
Scale consumers
Add instances to a consumer group, up to one per partition, to process faster.
Handling throttling gracefully
When a producer is throttled, it should wait and retry with growing delays rather than hammering the service. Client libraries include retry behaviour, and you should keep it enabled. On the consuming side, throttling shows up as slow reads, which often means the total read rate across all consumer groups is exceeding the egress allowance.
Capacity units are like the width of the motorway entrance. If more cars arrive than the slip road can take, a queue forms and drivers must wait. Widening the slip road, which is adding units, helps, and so does spreading arrivals over time.
Size for your realistic busiest period, not your average. A system that is fine on a quiet Tuesday can throttle on a promotion day, and unplanned scaling during an incident is stressful.
Every consumer group reads the full stream. Ten groups mean ten times the outgoing traffic. Include this in your capacity planning, since egress limits are easily reached by many readers.
12Reliability and Disaster Recovery
Plan for the day a datacentre, or a whole region, is unavailable.
Event Hubs stores events redundantly within a region, and supports availability zones in regions that offer them, so that a failure of one datacentre does not lose data or stop service. Protection against the loss of a whole region needs extra design, and the platform offers more than one approach.
| Approach | What is replicated | Notes |
|---|---|---|
| Availability zones | Data across datacentres within one region | Protects against a datacentre failure, available in supported regions |
| Geo-disaster recovery | Metadata only, such as the hubs and settings, between paired namespaces | Lets you fail over the configuration to another region, but event data itself is not copied |
| Geo-replication | Both metadata and event data between regions | Became generally available for Premium and Dedicated tiers in 2025, with options for how strictly replication is kept in step |
| Application-level replication | Whatever your application sends to two hubs | Producers or tools copy data to a second namespace, giving full control at the cost of complexity |
Designing for failure
Retry with backoff
Transient failures are normal in distributed systems. Keep client retry policies enabled and bounded.
Idempotent consumers
Failover and restarts cause some events to be re-read. Processing must tolerate duplicates.
Know your recovery targets
Decide how much data loss and downtime the business can accept, and choose the replication approach that meets those targets at an acceptable cost.
Rehearse failover
An untested failover plan is a hope, not a plan. Practise switching regions, including producers, consumers and checkpoint stores.
Consumer progress lives in the checkpoint store. If you fail over the hub but not the checkpoints, consumers may restart from the wrong position. Include checkpoint storage in your recovery design.
Replication features and the tiers that support them have been changing. Confirm what your tier supports in the current documentation before relying on it for a recovery plan.
13Security: Who May Send, Who May Read
A data stream often carries the most sensitive records a company has.
Streams of telemetry, transactions and logs can reveal customer behaviour and business secrets. Security therefore needs attention at several layers.
Identity-based access
Use Microsoft Entra identities and managed identities with built-in roles for sending and receiving. This avoids long-lived secrets and gives clear audit trails.
Shared access signatures
Keys and signed tokens still exist for simple or legacy cases. Scope them narrowly, such as send-only for a single hub, and rotate them.
Network restrictions
Use IP firewall rules, virtual network service endpoints and private endpoints so that only approved networks can reach the namespace. Newer network security perimeter options add further control where supported.
Encryption
Data is encrypted in transit and at rest. Higher tiers allow customer-managed keys for stricter requirements.
Separate send and listen rights
Producers should be able to send but not read, and consumers should be able to read but not send, limiting damage from a compromised client.
Governance of access
Features such as application groups let you define access and throttling policies for groups of client applications, protecting the namespace from a noisy or misbehaving client.
Securing a stream is like securing a motorway toll booth and control centre. Only registered vehicles may join, the control room is behind a locked door, observers may watch but not change the road, and the recordings are kept in a safe.
The namespace-level management key can do everything. Do not embed it in devices or applications. Create narrowly scoped identities or policies for each client instead.
Credentials embedded in thousands of field devices are hard to rotate. Use per-device identities where possible and have a plan to revoke a compromised device without disrupting the others.
14Monitoring, Logging and Metrics
In streaming, falling behind is the most common silent failure.
A streaming pipeline can look healthy while quietly slipping behind, until retention expires and data is lost. Monitoring must therefore cover the service itself, the producers and, most importantly, the consumers.
Service metrics to watch
Other useful measures include successful and failed requests, server errors, user errors such as authorisation problems, active connections, and capture backlog if Capture is enabled. A rising throttled count means capacity is too small or traffic is badly shaped.
Consumer lag
The most important health indicator for consumers is lag: how far behind the newest event each consumer group is, measured by comparing its checkpoint with the latest position in each partition. Growing lag means a consumer cannot keep up. If lag approaches the retention period, data will be lost before it is read. Track it, chart it and alert on it.
Logs, alerts and tracing
Diagnostic logs
Send operational and runtime logs to a central workspace to investigate authentication failures, throttling and connection problems.
Alerts
Alert on throttling, server errors, sudden drops in incoming traffic and rising consumer lag. A sudden silence from a producer is as important as a surge.
Correlation identifiers
Carry a trace or correlation identifier in event properties so a single transaction can be followed from producer through the stream to every consumer.
If a producer normally sends events every minute, create an alert when incoming messages drop to near zero. A quiet stream often means a broken sender, not a calm system.
Without lag monitoring, a stalled consumer is usually discovered when a report is wrong or a dashboard is empty, by which time data may already have expired.
15Cost, Tier Selection and Limits
Pay for capacity and volume, and avoid paying for waste.
Pricing differs by tier and changes over time, so use the official pricing page for current figures. In broad terms, the lower tiers charge for capacity units by the hour plus a charge per million events ingested, while the Dedicated tier charges for reserved capacity with a minimum period. Capture, geo-replication, extended retention and data transfer can add further charges.
What drives cost
Provisioned capacity
Units are billed for the time they are provisioned, whether or not you fully use them. Over-provisioning is the easiest way to overspend.
Event volume
Ingress charges scale with the number of events, so batching and keeping events small save money.
Retention
Keeping events longer than the included amount can incur storage charges. Use Capture for cheap long-term storage instead of extending retention.
Replication and transfer
Replicating data to another region or moving it across regions adds transfer costs and, for geo-replication, additional capacity.
Choosing a tier in practice
Prototype on a low tier
Use a small tier for experiments, remembering its feature limits.
Move to Standard for production basics
Most production workloads begin here, with Capture, Kafka compatibility and more consumer groups.
Choose Premium for isolation and advanced features
Select it when you need predictable performance, extended retention, geo-replication or stricter security options.
Consider Dedicated for the largest workloads
Use a reserved cluster when scale, isolation and cost predictability justify the commitment.
Cost-saving habits
- Batch events when sending
- Use compact formats and small payloads
- Right-size units and use auto-inflate with a ceiling
- Use Capture rather than long retention for history
- Delete unused hubs and consumer groups
Common cost surprises
- Idle capacity left provisioned after a project ends
- Retry storms from misbehaving clients
- Many consumer groups multiplying egress
Documented limits apply to partitions per hub, consumer groups, event and batch size, number of namespaces and more, and they vary by tier. Review them during design, since discovering a hard limit during a launch is painful.
16Common Architecture Patterns
A few shapes cover most real-world uses.
Once the building blocks are clear, a handful of patterns appear in almost every streaming solution.
Telemetry ingestion
Thousands of devices send readings into a hub. Stream processing detects anomalies in seconds, while Capture stores everything for later analysis and model training.
Log and metrics aggregation
Applications and servers across an estate send logs into a hub. Monitoring tools, security analytics and archives each read their own copy through separate consumer groups.
Clickstream and user behaviour
Website and app interactions stream in, feeding live personalisation, funnel analysis and a long-term data lake.
Event streaming backbone
Business systems publish changes as events, and other systems subscribe to keep their own views up to date, decoupling teams from one another.
Buffer in front of a slower system
A hub absorbs bursts so that a database or service that cannot take the peak directly can read at its own steady pace.
Event Grid plus Event Hubs
Event Grid announces discrete happenings, while Event Hubs carries the continuous stream. Many solutions use both, delivering notifications into a hub for processing.
Event Hubs is a transport and short-term log. Do not treat it as the permanent system of record or query it like a database. Keep durable copies in storage built for that purpose.
Some teams try to use the hub as the permanent store for event-sourced systems. Retention limits and cost make this risky. If you need an everlasting history, store events permanently elsewhere, for example by using Capture.
17Design Patterns and Anti-patterns
Shapes that scale, and shortcuts that hurt later.
Patterns worth adopting
Hot path and cold path
Stream processing for immediate reaction, and Capture for cheap, complete history.
Key by entity
Use a well-distributed identifier as the partition key to keep per-entity order without creating hot partitions.
One consumer group per application
Give each independent reader its own group so they never interfere with each other.
Idempotent processing
Make every consumer safe to re-run, using event identifiers or natural keys.
Schema governance
Register schemas, enforce compatibility and treat event formats as versioned public contracts.
Identity everywhere
Use managed identities and narrow roles for producers and consumers instead of shared keys.
Anti-patterns to avoid
Problem
Using Event Hubs as a task queue where each message must be processed once and then removed.
Why It’s Harmful
Reading does not remove events, there is no per-message acknowledgement, and duplicates after restarts are normal, so tasks may run twice or be missed.
Correct Approach
Use Service Bus for work items that need single processing, and keep Event Hubs for streams that many readers consume.
Problem
A single partition key value, such as a constant or a country code, is used for nearly all events.
Why It’s Harmful
All traffic lands on one partition, which becomes a bottleneck while the others sit idle, throttling the producer and limiting consumers to one reader.
Correct Approach
Choose a key with many evenly used values, or omit the key when order does not matter.
Problem
No monitoring of consumer lag and no archive of the stream.
Why It’s Harmful
A stalled consumer silently falls behind until events expire, and the lost data cannot be recovered.
Correct Approach
Alert on lag and throttling, and enable Capture so there is always a durable copy.
Problem
Every application shares the namespace-level key and the same consumer group.
Why It’s Harmful
A leaked key exposes everything, and applications interfere with each other’s reading, causing missing data and duplicate work.
Correct Approach
Give each application its own identity with minimal rights and its own consumer group.
18Best Practices and Common Mistakes
Habits that separate calm streaming systems from fragile ones.
Best practices
- Pick the right tool. Streams to Event Hubs, notifications to Event Grid and reliable commands to Service Bus.
- Plan partitions deliberately. Base the count on peak throughput and desired parallelism, and understand your tier’s rules for changing it later.
- Batch when sending. Send groups of events and keep payloads compact.
- Use the event processor. Rely on library support for load balancing and checkpointing rather than writing your own.
- Design for duplicates. Idempotent consumers make restarts and failover harmless.
- Archive with Capture. Keep a durable copy of important streams.
- Secure with identities. Managed identities, narrow roles, private networking and customer-managed keys where required.
- Monitor lag, throttling and silence. Alert before data is lost.
- Govern schemas. Register them and enforce compatibility.
- Automate and document. Define namespaces, hubs and consumer groups in code, and keep diagrams and owners current.
Common mistakes
Assuming global ordering. Order is guaranteed only within a partition. Applications that need strict order across all events must redesign, for example by keying related events to the same partition.
Expecting more readers than partitions to help. Within a consumer group, extra instances beyond the partition count sit idle. Parallelism is capped by partitions.
Checkpointing before processing. If you save the checkpoint first and then crash, events are skipped and lost to that consumer. Checkpoint only after the work is safely done.
Ignoring retention. Teams assume data stays forever, then discover that a week-old event is gone. Know your retention period and design backfill, replay and archive accordingly.
Overlooking permissions on the checkpoint store. If consumers cannot write checkpoints, they will repeatedly reprocess the same events or fail to balance partitions. Grant the right storage access to the consumer identity.
When data seems missing or late, check in this order: Are producers sending successfully, and are there authorisation or throttling errors? Is the event going to the expected hub and partition? Is the consumer group correct and is the processor healthy? Are checkpoints advancing? Is consumer lag growing, and is retention close to expiry? Metrics comparing incoming and outgoing messages usually show where the flow breaks.
19Real-world and Industry Examples
How different organisations put the wide river to work.
The following scenarios are typical patterns rather than descriptions of specific companies. They show how the same building blocks combine for very different needs.
Manufacturer monitoring machines
Sensors on production lines stream vibration and temperature readings. Stream processing flags abnormal patterns within seconds and raises maintenance tickets, while Capture stores every reading so data scientists can train failure-prediction models later.
Retailer personalising the shop
Clicks and searches flow into a hub from the website and app. A live pipeline updates recommendations in near real time, and the same stream feeds nightly analysis of conversion and abandoned baskets.
Bank detecting fraud
Card transactions are keyed by account so that each account’s events stay in order. A fraud-scoring service reads them in real time, while a compliance team reads the same stream through a separate consumer group for monitoring and reporting.
Logistics company tracking vehicles
Vehicles send positions every few seconds. A live map and delivery estimates are updated continuously, and archived tracks support route optimisation and dispute resolution.
Game studio handling player activity
Millions of in-game actions stream in during busy evenings. Live dashboards show player counts and issues, and the studio uses auto-inflate with a ceiling to survive launch-day spikes without constant manual scaling.
Company migrating from self-managed Kafka
A company running its own Kafka clusters points its applications at the Event Hubs Kafka endpoint after testing compatibility. It retires the clusters and their maintenance work, keeping its existing producers, consumers and tools.
Security team centralising logs
Logs from applications, networks and cloud services flow into hubs. Security analytics tools and long-term archives read separate copies, giving full visibility without each source needing to know about every destination.
20Frequently Asked Questions
Quick answers to questions that come up again and again.
Event Hubs ingests high-volume streams that many consumers can read and replay. Event Grid routes discrete notifications to handlers. Service Bus provides reliable business messaging where each message is processed and removed.
No. Events stay until the retention period ends, and each consumer group keeps its own position. That is why multiple readers and replay are possible.
A partition is an ordered lane within an event hub. Partitions allow parallel writing and reading, and order is guaranteed only within one partition.
A named, independent view of the event hub. Each consumer group tracks its own position, so different applications can read the same events at their own pace.
Often yes. Event Hubs offers a Kafka-compatible endpoint, so many Kafka clients connect with configuration changes. Test for any features you rely on, and use a tier that supports it.
For a limited retention period that depends on the tier, with longer retention in higher tiers. For permanent storage, use Capture to write events to storage.
Use the event processor with checkpoints, make processing idempotent, monitor lag and make sure retention is long enough for the consumer to recover.
When traffic exceeds the capacity of your units, the service slows or rejects requests. Handle it with retries and backoff, and add capacity or reduce traffic.
Geo-disaster recovery copies metadata only and lets you fail over configuration to a paired namespace. Geo-replication, available for Premium and Dedicated tiers, replicates both metadata and event data. Confirm current details in the documentation.
Prefer Microsoft Entra and managed identities with narrow roles, restrict networks with firewalls and private endpoints, use customer-managed keys where required and never embed the namespace root key in applications.
Usually not. It has a restricted feature set, such as no Capture or Kafka endpoint, and limited consumer groups. Most production workloads start at Standard or above.
21Summary and Key Takeaways
Azure Event Hubs is the wide river for streaming data. Producers pour in events at enormous volume, the service spreads them across partitions and keeps them in an ordered, replayable log for a limited time, and any number of consumer groups read them independently, while Capture, stream processing and analytics services turn the flow into archives, dashboards and actions. Success depends on a handful of design choices: picking Event Hubs for streams rather than queues or notifications, planning partitions and keys for scale and ordering, building idempotent consumers with sensible checkpointing, securing access with identities and private networking, choosing the right tier and replication approach, and watching lag, throttling and silence so that no data is lost quietly. Because tiers, replication features and integrations keep evolving, always confirm current capabilities and limits in the official documentation.
Key Takeaways
- It is a log, not a queue — events stay until retention expires, many consumer groups read independently and consumers can replay from a saved position.
- Partitions drive scale and ordering — they give parallelism, order exists only within a partition, and good partition keys avoid hot spots.
- Consumers must tolerate duplicates — use the event processor, checkpoint after processing and make handlers idempotent.
- Choose the right service and tier — streams to Event Hubs, notifications to Event Grid and commands to Service Bus, with Standard or above for production features such as Capture and Kafka compatibility.
- Archive and process in two paths — use stream processing for the hot path and Capture for a durable cold path, because retention is limited.
- Secure with identities and networks — managed identities, narrow roles, private networking, customer-managed keys where needed and no shared root keys.
- Monitor lag, throttling and silence — plan capacity for peaks, design for regional failure with the right replication option and verify feature maturity before relying on it.