Cloud Native Actors: Streamstone storage for Azure Tables
Install
| Product | Versions |
|---|---|
| .NET |
README
Streamstone storage provider for Orleans grain persistence, supporting Cloud Actors on Azure Table Storage.
Features
- Supports plain CLR objects as grain state
- Supports event sourced actors
- Supports automatic snapshots for faster state reading
See Streamstone for more details.
Usage
Register the provider via the Orleans silo builder:
and provide a CloudStorageAccount singleton:
var builder = WebApplication.CreateBuilder(args);
builder.UseOrleans(silo =>
{
// π register Streamstone as the default storage provider for all grains/actors
silo.AddStreamstoneActorStorageAsDefault(opt => opt.AutoSnapshot = true);
});
builder.Services.AddCloudActors(); // π registers grains, serializers, etc.
Alternatively, you can register the provider under a specific name instead of the default:
silo.AddStreamstoneActorStorage("streamstone", opt => opt.AutoSnapshot = true);
And actors can then opt in to the named provider explicitly:
[Actor(nameof(Account), "streamstone")]
public partial class Account : IEventSourced
Storage
The Streamstone storage provider depends on Devlooped.CloudStorage
(CloudStorageAccount) which must be registered in the DI container too:
builder.Services.AddSingleton(
builder.Environment.IsDevelopment() ?
// Use the development emulator locally:
CloudStorageAccount.DevelopmentStorageAccount :
// Or provide a real account for production:
CloudStorageAccount.Parse(builder.Configuration.GetConnectionString("AzureStorage") ??
throw new ArgumentException("Missing required AzureStorage connection string.")));
Clustering
It's quite common to use localhost clustering during development, and azure storage in production, for example:
builder.UseOrleans(silo =>
{
if (builder.Environment.IsProduction())
{
silo.UseAzureStorageClustering(options =>
{
options.TableServiceClient = new Azure.Data.Tables.TableServiceClient(
builder.Configuration["AzureStorage"] ??
builder.Configuration["AzureWebJobsStorage"]);
});
}
else
{
silo.UseLocalhostClustering();
}
// π register Streamstone as the default storage provider for all grains/actors
silo.AddStreamstoneActorStorageAsDefault(opt => opt.AutoSnapshot = true);
});
Open Source Maintenance Fee
To ensure the long-term sustainability of this project, users of this package who generate revenue must pay an Open Source Maintenance Fee. While the source code is freely available under the terms of the License, this package and other aspects of the project require adherence to the Maintenance Fee.
To pay the Maintenance Fee, become a Sponsor at the proper OSMF tier. A single fee covers all of Devlooped packages.
Sponsors
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.