Install
dotnet add package Microsoft.Orleans.Clustering.AzureStorage --version 10.3.0
| Product | Versions |
|---|---|
| .NET |
README
Microsoft Orleans Clustering Provider for Azure Storage
Introduction
Microsoft Orleans Clustering Provider for Azure Storage allows Orleans silos to organize themselves as a cluster using Azure Table Storage. This provider enables silos to discover each other, maintain cluster membership, and detect and handle failures.
Getting Started
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Clustering.AzureStorage
Example - Configuring Azure Storage Clustering
using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
// Define a grain interface
public interface IHelloGrain : IGrainWithStringKey
{
Task<string> SayHello(string greeting);
}
// Implement the grain interface
public class HelloGrain : Grain, IHelloGrain
{
public Task<string> SayHello(string greeting)
{
return Task.FromResult($"Hello, {greeting}!");
}
}
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
// Configure Azure Table Storage for clustering
.UseAzureStorageClustering(options =>
{
options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
options.TableName = "OrleansClustering"; // Optional: defaults to "OrleansClustering"
});
});
var host = builder.Build();
await host.StartAsync();
// Get a reference to a grain and call it
var client = host.Services.GetRequiredService<IClusterClient>();
var grain = client.GetGrain<IHelloGrain>("user123");
var response = await grain.SayHello("World");
// Print the result
Console.WriteLine($"Grain response: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
Example - Configuring Client to Connect to Cluster
using Microsoft.Extensions.Hosting;
using Orleans;
using Orleans.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
namespace ExampleGrains;
// Define a grain interface
public interface IHelloGrain : IGrainWithStringKey
{
Task<string> SayHello(string greeting);
}
var clientBuilder = Host.CreateApplicationBuilder(args)
.UseOrleansClient(clientBuilder =>
{
clientBuilder
// Configure the client to use Azure Storage for clustering
.UseAzureStorageClustering(options =>
{
options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
options.TableName = "OrleansClustering"; // Optional: defaults to "OrleansClustering"
});
});
var host = clientBuilder.Build();
await host.StartAsync();
var client = host.Services.GetRequiredService<IClusterClient>();
// Get a reference to a grain and call it
var grain = client.GetGrain<IHelloGrain>("user123");
var response = await grain.SayHello("World");
// Print the result
Console.WriteLine($"Grain response: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
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
Changes from Previous Version
No structural changes between v10.3.0-rc.1 and v10.3.0.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.The published metadata declares 57 direct dependency entries across framework groups. Inspect the resolved dependency graph for your target framework.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.