Microsoft.Orleans.Streaming.EventHubs
10.3.1
Prefix Reserved
dotnet add package Microsoft.Orleans.Streaming.EventHubs --version 10.3.1
NuGet\Install-Package Microsoft.Orleans.Streaming.EventHubs -Version 10.3.1
<PackageReference Include="Microsoft.Orleans.Streaming.EventHubs" Version="10.3.1" />
<PackageVersion Include="Microsoft.Orleans.Streaming.EventHubs" Version="10.3.1" />
<PackageReference Include="Microsoft.Orleans.Streaming.EventHubs" />
paket add Microsoft.Orleans.Streaming.EventHubs --version 10.3.1
#r "nuget: Microsoft.Orleans.Streaming.EventHubs, 10.3.1"
#:package Microsoft.Orleans.Streaming.EventHubs@10.3.1
#addin nuget:?package=Microsoft.Orleans.Streaming.EventHubs&version=10.3.1
#tool nuget:?package=Microsoft.Orleans.Streaming.EventHubs&version=10.3.1
Microsoft Orleans Stream Provider for Azure Event Hubs
Introduction
Microsoft Orleans Stream Provider for Azure Event Hubs enables Orleans applications to leverage Azure Event Hubs for reliable, scalable event processing. This provider allows you to use Event Hubs as a streaming backbone for your Orleans application to both produce and consume streams of events.
Getting Started
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Streaming.EventHubs
Example - Configuring Event Hubs Stream Provider
using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
namespace ExampleGrains;
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
.UseLocalhostClustering()
// Configure Azure Event Hubs as a stream provider
.AddEventHubStreams(
"EventHubStreamProvider",
configurator =>
{
configurator.ConfigureEventHub(builder => builder.Configure(options =>
{
options.ConnectionString = "YOUR_EVENT_HUB_CONNECTION_STRING";
options.ConsumerGroup = "YOUR_CONSUMER_GROUP"; // Default is "$Default"
options.Path = "YOUR_EVENT_HUB_NAME";
}));
configurator.UseAzureTableCheckpointer(builder => builder.Configure(options =>
{
options.ConnectionString = "YOUR_STORAGE_CONNECTION_STRING";
options.TableName = "EventHubCheckpoints"; // Optional
}));
});
});
// Run the host
await builder.RunAsync();
Using Orleans grain storage for checkpoints
Azure Table Storage remains the default checkpoint store for compatibility with existing deployments. As an alternative, checkpoints can be stored using Orleans grains and the configured PubSubStore grain storage provider:
siloBuilder
.AddMemoryGrainStorage("PubSubStore")
.AddEventHubStreams("EventHubStreamProvider", configurator =>
{
configurator.ConfigureEventHub(builder => builder.Configure(options =>
{
options.ConnectionString = "YOUR_EVENT_HUB_CONNECTION_STRING";
options.ConsumerGroup = "YOUR_CONSUMER_GROUP";
options.Path = "YOUR_EVENT_HUB_NAME";
}));
configurator.UseGrainCheckpointer(builder => builder.Configure(options =>
{
options.PersistInterval = TimeSpan.FromSeconds(30);
}));
});
The grain checkpointer applies numeric ordering to Event Hubs offsets so that an older offset cannot overwrite a newer checkpoint. Configure a durable PubSubStore provider in production; in-memory grain storage does not preserve checkpoints across cluster restarts. Switching checkpoint stores does not migrate existing offsets and can cause events to be replayed.
Set GrainStreamQueueCheckpointerOptions.StorageProviderName to use another registered grain storage provider.
Both UseGrainCheckpointer and UseAzureTableCheckpointer extend ISiloPersistentStreamConfigurator, so they can also be used with other persistent stream providers. Event Hubs configures numeric checkpoint ordering by default; other providers can set the corresponding CheckpointComparer option for their checkpoint format.
Example - Using Event Hub Streams in a Grain
// Grain interface
public interface IStreamProcessingGrain : IGrainWithGuidKey
{
Task StartProcessing();
}
// Grain implementation
public class StreamProcessingGrain : Grain, IStreamProcessingGrain
{
private IStreamProvider _streamProvider;
private IAsyncStream<MyEvent> _stream;
private StreamSubscriptionHandle<MyEvent> _subscription;
public override async Task OnActivateAsync(CancellationToken cancellationToken)
{
// Get the stream provider
_streamProvider = GetStreamProvider("EventHubStreamProvider");
// Get a reference to a specific stream
_stream = _streamProvider.GetStream<MyEvent>(this.GetPrimaryKey(), "MyStreamNamespace");
await base.OnActivateAsync(cancellationToken);
}
public async Task StartProcessing()
{
// Subscribe to the stream to process events
_subscription = await _stream.SubscribeAsync(OnNextAsync);
}
private Task OnNextAsync(MyEvent evt, StreamSequenceToken token)
{
Console.WriteLine($"Received event: {evt.Data}");
return Task.CompletedTask;
}
// Produce an event to the stream
public Task SendEvent(MyEvent evt)
{
return _stream.OnNextAsync(evt);
}
}
// Event class
public class MyEvent
{
public string Data { get; set; }
}
Documentation
For more comprehensive documentation, please refer to:
Feedback & Contributing
- If you have any issues or would like to provide feedback, please open an issue on GitHub
- Join our community on Discord
- Follow the @msftorleans Twitter account for Orleans announcements
- Contributions are welcome! Please review our contribution guidelines
- This project is licensed under the MIT license
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Azure.Core (>= 1.51.1)
- Azure.Data.Tables (>= 12.11.0)
- Azure.Identity (>= 1.18.0)
- Azure.Messaging.EventHubs (>= 5.12.2)
- Microsoft.AspNetCore.Connections.Abstractions (>= 10.0.3)
- Microsoft.CodeAnalysis.Analyzers (>= 3.11.0)
- Microsoft.CodeAnalysis.Common (>= 5.0.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 5.0.0)
- Microsoft.Extensions.Configuration (>= 10.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.Configuration.Json (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.DependencyModel (>= 10.0.5)
- Microsoft.Extensions.Hosting (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Console (>= 10.0.5)
- Microsoft.Extensions.Logging.Debug (>= 10.0.5)
- Microsoft.Extensions.ObjectPool (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
- Microsoft.Orleans.Streaming (>= 10.3.1)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.4)
- Polly.Extensions (>= 8.6.5)
- System.IO.Hashing (>= 10.0.3)
- System.Memory.Data (>= 10.0.3)
-
net8.0
- Azure.Core (>= 1.50.0)
- Azure.Data.Tables (>= 12.11.0)
- Azure.Identity (>= 1.17.1)
- Azure.Messaging.EventHubs (>= 5.12.2)
- Microsoft.AspNetCore.Connections.Abstractions (>= 8.0.24)
- Microsoft.CodeAnalysis.Analyzers (>= 3.11.0)
- Microsoft.CodeAnalysis.Common (>= 4.5.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 4.5.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.Configuration.Json (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.DependencyModel (>= 8.0.2)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Logging.Console (>= 8.0.1)
- Microsoft.Extensions.Logging.Debug (>= 8.0.1)
- Microsoft.Extensions.ObjectPool (>= 8.0.24)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Orleans.Streaming (>= 10.3.1)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.4)
- Polly.Extensions (>= 8.6.5)
- System.IO.Hashing (>= 10.0.3)
- System.IO.Pipelines (>= 8.0.0)
- System.Memory.Data (>= 8.0.1)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Microsoft.Orleans.Streaming.EventHubs:
| Package | Downloads |
|---|---|
|
Microsoft.AutoGen.RuntimeGateway.Grpc
A programming framework for agentic AI |
|
|
Egil.Orleans.Messaging.Streams.EventHubs
Event Hubs-specific stream token enrichment for Egil.Orleans.Messaging. |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Microsoft.Orleans.Streaming.EventHubs:
| Repository | Stars |
|---|---|
|
dotnet/samples
Sample code referenced by the .NET documentation
|
|
|
J-Tech-Japan/Sekiban
Sekiban - an Opinionated Event Sourcing and CQRS Framework using C#. It can store data into Azure Cosmos DB, AWS Dynamo DB or Postgres
|
|
|
microsoft/project-oagents
Experimental AI Agents Framework
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.3.1 | 406 | 8/28/2026 |
| 10.3.0 | 310 | 8/27/2026 |
| 10.3.0-rc.1 | 57 | 8/25/2026 |
| 10.2.2 | 11,073 | 7/21/2026 |
| 10.2.2-rc.2 | 111 | 7/15/2026 |
| 10.2.2-rc.1 | 109 | 7/10/2026 |
| 10.2.1 | 16,458 | 6/24/2026 |
| 10.2.1-preview.1 | 103 | 6/19/2026 |
| 10.2.0 | 1,256 | 6/12/2026 |
| 10.1.1-preview.1 | 78 | 5/13/2026 |
| 10.1.0 | 22,522 | 4/14/2026 |
| 10.0.1 | 47,402 | 2/7/2026 |
| 10.0.0 | 5,961 | 1/20/2026 |
| 10.0.0-rc.2 | 175 | 12/31/2025 |
| 9.2.1 | 84,764 | 7/16/2025 |
| 9.2.0 | 1,366 | 7/14/2025 |
| 9.2.0-preview3 | 535 | 6/10/2025 |
| 9.2.0-preview2 | 229 | 6/4/2025 |
| 9.2.0-preview1 | 5,434 | 4/4/2025 |
| 9.1.2 | 77,558 | 2/13/2025 |