Azure Event Hubs
Azure Event Hubs is a fully managed, real-time data ingestion service that can receive and process millions of events per second. It serves as the front‑door for an event pipeline, enabling you to capture, buffer, store, and process large volumes of data from distributed applications and devices.
Getting Started
Follow these steps to create an Event Hub and send events using the Azure portal and .NET SDK.
- Log in to the Azure portal.
- Create a new Event Hubs namespace.
- Within the namespace, add an Event Hub and note its name.
- Configure a Shared Access Policy with
Send
permissions.
Send events with .NET
using Azure.Messaging.EventHubs;
using Azure.Messaging.EventHubs.Producer;
string connectionString = "<EVENT_HUBS_NAMESPACE_CONNECTION_STRING>";
string eventHubName = "<EVENT_HUB_NAME>";
await using (var producer = new EventHubProducerClient(connectionString, eventHubName))
{
using EventDataBatch eventBatch = await producer.CreateBatchAsync();
eventBatch.TryAdd(new EventData(new BinaryData("First event")));
eventBatch.TryAdd(new EventData(new BinaryData("Second event")));
await producer.SendAsync(eventBatch);
Console.WriteLine("Events sent.");
}
Core Concepts
Component | Description |
---|---|
Namespace | A container for one or more Event Hubs, providing isolation and management. |
Event Hub | A stream of events. Each hub has partitions for scalability. |
Partition | A ordered sequence of events. Enables parallel processing. |
Consumer Group | A view of the event stream, allowing multiple independent readers. |
Capture | Automatically persists incoming data to Azure Blob Storage or Azure Data Lake. |
Code Samples
Explore official samples for different languages:
API Reference
Official REST API documentation: Event Hubs REST API
SDK reference docs: .NET | JavaScript
FAQ
- How many events can Event Hubs process per second?
- Throughput units determine capacity. One unit supports up to 1 MB/s or 1,000 events/s. Multiple units scale linearly.
- What is the maximum retention period?
- Retention can be configured up to 90 days for Standard tier and 365 days for Premium tier.