Microsoft.Orleans.Streaming.EventHubs 9.2.0

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Orleans.Streaming.EventHubs --version 9.2.0
                    
NuGet\Install-Package Microsoft.Orleans.Streaming.EventHubs -Version 9.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Orleans.Streaming.EventHubs" Version="9.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Orleans.Streaming.EventHubs" Version="9.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Streaming.EventHubs" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Orleans.Streaming.EventHubs --version 9.2.0
                    
#r "nuget: Microsoft.Orleans.Streaming.EventHubs, 9.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Orleans.Streaming.EventHubs@9.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Orleans.Streaming.EventHubs&version=9.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Streaming.EventHubs&version=9.2.0
                    
Install as a Cake Tool

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();

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

Product 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Microsoft.Orleans.Streaming.EventHubs:

Package Downloads
Microsoft.AutoGen.RuntimeGateway.Grpc

A programming framework for agentic AI

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Microsoft.Orleans.Streaming.EventHubs:

Repository Stars
microsoft/project-oagents
Experimental AI Agents Framework
Version Downloads Last Updated
9.2.1 4,034 7/16/2025
9.2.0 395 7/14/2025
9.2.0-preview3 427 6/10/2025
9.2.0-preview2 148 6/4/2025
9.2.0-preview1 5,304 4/4/2025
9.1.2 43,288 2/13/2025
9.0.1 40,434 11/23/2024
9.0.0 1,093 11/14/2024
8.2.0 64,690 7/12/2024
8.2.0-preview1 153 5/22/2024
8.1.0 23,376 4/17/2024
8.1.0-preview3 1,061 3/11/2024
8.1.0-preview2 128 2/23/2024
8.1.0-preview1 1,224 2/13/2024
8.0.0 11,543 1/5/2024
8.0.0-rc2 189 12/20/2023
8.0.0-rc1 180 12/4/2023
7.2.7 303 10/15/2024
7.2.6 941 3/9/2024
7.2.5 323 2/22/2024
7.2.4 9,679 12/2/2023
7.2.3 4,120 11/3/2023
7.2.2 835 10/16/2023
7.2.1 6,147 7/11/2023
7.2.0 2,817 7/7/2023
7.1.2 3,831 4/19/2023
7.1.1 4,265 3/23/2023
7.1.0 5,599 2/1/2023
7.0.0 10,746 11/8/2022
7.0.0-rc2 487 10/19/2022
4.0.0-preview2 688 8/4/2022
4.0.0-preview1 483 2/10/2022