Microsoft.Orleans.Streaming.AzureStorage 9.2.0-preview2

Prefix Reserved
This is a prerelease version of Microsoft.Orleans.Streaming.AzureStorage.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Orleans.Streaming.AzureStorage --version 9.2.0-preview2
                    
NuGet\Install-Package Microsoft.Orleans.Streaming.AzureStorage -Version 9.2.0-preview2
                    
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.AzureStorage" Version="9.2.0-preview2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Orleans.Streaming.AzureStorage" Version="9.2.0-preview2" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Streaming.AzureStorage" />
                    
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.AzureStorage --version 9.2.0-preview2
                    
#r "nuget: Microsoft.Orleans.Streaming.AzureStorage, 9.2.0-preview2"
                    
#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.AzureStorage@9.2.0-preview2
                    
#: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.AzureStorage&version=9.2.0-preview2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Streaming.AzureStorage&version=9.2.0-preview2&prerelease
                    
Install as a Cake Tool

Microsoft Orleans Streaming for Azure Storage Queues

Introduction

Microsoft Orleans Streaming for Azure Storage provides a stream provider implementation for Orleans using Azure Storage Queues. This allows for publishing and subscribing to streams of events with Azure Storage Queues as the underlying messaging infrastructure.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Streaming.AzureStorage

Example - Configuring Azure Storage Queues Streaming

using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Orleans.Streams;

var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Configure Azure Storage Queues as a stream provider
            .AddAzureQueueStreams(
                name: "AzureQueueStreamProvider", 
                b => b.ConfigureAzureQueue(ob => ob.Configure((options, dep) =>
                {
                    options.ConfigureTestDefaults();
                    options.QueueNames = Enumerable.Range(0, 8).Select(num => $"{dep.Value.ClusterId}-{num}").ToList();
                })));
    });

// Run the host
await builder.RunAsync();

Example - Using Azure Storage Queue Streams in a Grain

// Producer grain
public class ProducerGrain : Grain, IProducerGrain
{
    private IAsyncStream<string> _stream;

    public override Task OnActivateAsync(CancellationToken cancellationToken)
    {
        // Get a reference to a stream
        var streamProvider = GetStreamProvider("AzureQueueStreamProvider");
        _stream = streamProvider.GetStream<string>(Guid.NewGuid(), "MyStreamNamespace");
        
        return base.OnActivateAsync(cancellationToken);
    }

    public async Task SendMessage(string message)
    {
        // Send a message to the stream
        await _stream.OnNextAsync(message);
    }
}

// Consumer grain
public class ConsumerGrain : Grain, IConsumerGrain, IAsyncObserver<string>
{
    private StreamSubscriptionHandle<string> _subscription;

    public override async Task OnActivateAsync(CancellationToken cancellationToken)
    {
        // Get a reference to a stream
        var streamProvider = GetStreamProvider("AzureQueueStreamProvider");
        var stream = streamProvider.GetStream<string>(this.GetPrimaryKey(), "MyStreamNamespace");
        
        // Subscribe to the stream
        _subscription = await stream.SubscribeAsync(this);
        
        await base.OnActivateAsync(cancellationToken);
    }

    public Task OnNextAsync(string item, StreamSequenceToken token = null)
    {
        Console.WriteLine($"Received message: {item}");
        return Task.CompletedTask;
    }

    public Task OnCompletedAsync()
    {
        Console.WriteLine("Stream completed");
        return Task.CompletedTask;
    }

    public Task OnErrorAsync(Exception ex)
    {
        Console.WriteLine($"Stream error: {ex.Message}");
        return Task.CompletedTask;
    }
}

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

Showing the top 3 NuGet packages that depend on Microsoft.Orleans.Streaming.AzureStorage:

Package Downloads
Blauhaus.Orleans

Package Description

Blauhaus.EVACS.Orleans

Package Description

Microsoft.Orleans.OrleansAzureUtils

Support library for hosting Orleans on Microsoft Azure.

GitHub repositories (3)

Showing the top 3 popular GitHub repositories that depend on Microsoft.Orleans.Streaming.AzureStorage:

Repository Stars
Dotnet-Boxed/Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
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
Version Downloads Last Updated
9.2.1 4,311 7/16/2025
9.2.0 359 7/14/2025
9.2.0-preview3 448 6/10/2025
9.2.0-preview2 174 6/4/2025
9.2.0-preview1 460 4/4/2025
9.1.2 42,680 2/13/2025
9.0.1 8,001 11/23/2024
9.0.0 1,969 11/14/2024
8.2.0 41,248 7/12/2024
8.2.0-preview1 244 5/22/2024
8.1.0 25,150 4/17/2024
8.1.0-preview3 307 3/11/2024
8.1.0-preview2 189 2/23/2024
8.1.0-preview1 183 2/13/2024
8.0.0 20,113 1/5/2024
8.0.0-rc2 267 12/20/2023
8.0.0-rc1 254 12/4/2023
7.2.7 277 10/15/2024
7.2.6 5,941 3/9/2024
7.2.5 301 2/22/2024
7.2.4 12,333 12/2/2023
7.2.3 9,697 11/3/2023
7.2.2 2,419 10/16/2023
7.2.1 32,787 7/11/2023
7.2.0 2,699 7/7/2023
7.1.2 10,168 4/19/2023
7.1.1 4,277 3/23/2023
7.1.0 10,532 2/1/2023
7.0.0 2,916 11/8/2022
7.0.0-rc2 315 10/19/2022
4.0.0-preview2 4,767 8/4/2022
4.0.0-preview1 2,065 2/10/2022
3.8.0 207 5/6/2025
3.8.0-preview5 256 5/12/2025
3.8.0-preview3 208 4/8/2025
3.8.0-preview2 156 4/4/2025
3.8.0-preview1 212 3/31/2025
3.7.2 15,965 5/10/2024
3.7.1 33,741 5/27/2023
3.7.0 6,784 3/23/2023
3.6.5 450,644 8/15/2022
3.6.4 6,023 8/10/2022
3.6.3 38,406 8/4/2022
3.6.2 509,517 4/15/2022
3.6.1 17,838 4/5/2022
3.6.0 34,026 1/20/2022
3.5.1 78,531 11/8/2021
3.5.0 26,409 9/3/2021
3.4.4 1,971 10/4/2021
3.4.3 3,106 6/3/2021
3.4.2 10,157 4/5/2021
3.4.1 6,380 2/3/2021
3.4.0 21,367 1/6/2021
3.4.0-rc1 643 12/9/2020
3.3.0 14,687 9/9/2020
3.3.0-rc2 614 9/2/2020
3.3.0-rc1 582 8/19/2020
3.2.2 5,520 7/22/2020
3.2.1 2,275 7/2/2020
3.2.0 4,037 6/4/2020
3.2.0-rc2 807 5/20/2020
3.2.0-rc1 652 5/7/2020
3.1.7 1,264 5/19/2020
3.1.6 6,629 4/16/2020
3.1.5 1,241 4/9/2020
3.1.4 12,878 3/26/2020
3.1.3 5,503 3/16/2020
3.1.2 4,242 3/5/2020
3.1.0 1,364 2/23/2020
3.1.0-rc3 716 2/13/2020
3.1.0-rc2 732 2/12/2020
3.1.0-rc1 752 2/10/2020
3.0.2 7,607 12/12/2019
3.0.1 2,283 11/27/2019
3.0.0 1,898 10/24/2019
3.0.0-rc2 671 10/16/2019
3.0.0-rc1 625 10/9/2019
3.0.0-beta1 677 8/16/2019
2.4.5 6,464 12/29/2019
2.4.4 3,519 11/27/2019
2.4.3 5,514 10/10/2019
2.4.2 4,830 8/31/2019
2.4.1 11,487 8/14/2019
2.4.0 5,031 8/8/2019
2.3.6 22,123 7/24/2019
2.3.5 3,744 6/14/2019
2.3.4 2,793 6/4/2019
2.3.3 2,523 6/2/2019
2.3.2 4,075 5/9/2019
2.3.1 2,904 4/26/2019
2.3.0 8,077 3/20/2019
2.3.0-rc2 2,127 3/13/2019
2.3.0-rc1 1,902 3/4/2019
2.2.4 3,298 2/25/2019
2.2.3 3,450 1/17/2019
2.2.0 7,916 12/13/2018
2.2.0-rc1 2,111 12/4/2018
2.2.0-beta1 2,673 10/21/2018
2.1.2 10,286 10/11/2018
2.1.0 3,496 9/28/2018
2.1.0-rc2 2,570 9/21/2018
2.1.0-rc1 2,595 9/14/2018
2.1.0-beta1 1,132 8/27/2018
2.0.0 15,949 3/28/2018
2.0.0-rc2 3,342 3/13/2018
2.0.0-rc1 4,216 2/26/2018
2.0.0-beta3 4,685 12/21/2017
2.0.0-beta2 2,893 12/11/2017