Orleans.Journaling.AzureStorage
9.2.1-alpha.1
This is a prerelease version of Orleans.Journaling.AzureStorage.
dotnet add package Orleans.Journaling.AzureStorage --version 9.2.1-alpha.1
NuGet\Install-Package Orleans.Journaling.AzureStorage -Version 9.2.1-alpha.1
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="Orleans.Journaling.AzureStorage" Version="9.2.1-alpha.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Orleans.Journaling.AzureStorage" Version="9.2.1-alpha.1" />
<PackageReference Include="Orleans.Journaling.AzureStorage" />
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 Orleans.Journaling.AzureStorage --version 9.2.1-alpha.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Orleans.Journaling.AzureStorage, 9.2.1-alpha.1"
#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 Orleans.Journaling.AzureStorage@9.2.1-alpha.1
#: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=Orleans.Journaling.AzureStorage&version=9.2.1-alpha.1&prerelease
#tool nuget:?package=Orleans.Journaling.AzureStorage&version=9.2.1-alpha.1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Microsoft Orleans Journaling for Azure Storage
Introduction
Microsoft Orleans Journaling for Azure Storage provides an Azure Storage implementation of the Orleans Journaling provider. This allows logging and tracking of grain operations using Azure Storage as a backing store.
Getting Started
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Journaling.AzureStorage
Example - Configuring Azure Storage Journaling
using Microsoft.Extensions.Hosting;
using Orleans.Hosting;
using Orleans.Configuration;
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using MyGrainNamespace;
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
.UseLocalhostClustering()
// Configure Azure Storage as a journaling provider
.AddAzureAppendBlobStateMachineStorage(optionsBuilder =>
{
optionsBuilder.Configure((options, serviceProvider) => options.BlobServiceClient = serviceProvider.GetRequiredService<BlobServiceClient>());
});
});
var host = await builder.StartAsync();
// Get a reference to the grain
var shoppingCart = host.Services.GetRequiredService<IGrainFactory>()
.GetGrain<IShoppingCartGrain>("user1-cart");
// Use the grain
await shoppingCart.UpdateItem("apple", 5, 0);
await shoppingCart.UpdateItem("banana", 3, 1);
// Get and print the cart contents
var (contents, version) = await shoppingCart.GetCart();
Console.WriteLine($"Shopping cart (version {version}):");
foreach (var item in contents)
{
Console.WriteLine($"- {item.Key}: {item.Value}");
}
// Wait for the application to terminate
await host.WaitForShutdownAsync();
Example - Using Journaling in a Grain
using Orleans.Runtime;
namespace MyGrainNamespace;
public interface IShoppingCartGrain : IGrain
{
ValueTask<(bool success, long version)> UpdateItem(string itemId, int quantity, long version);
ValueTask<(Dictionary<string, int> Contents, long Version)> GetCart();
ValueTask<long> GetVersion();
ValueTask<(bool success, long version)> Clear(long version);
}
public class ShoppingCartGrain(
[FromKeyedServices("shopping-cart")] IDurableDictionary cart,
[FromKeyedServices("version")] IDurableValue<long> version) : DurableGrain, IShoppingCartGrain
{
private readonly IDurableValue<long> _version = version;
public async ValueTask<(bool success, long version)> UpdateItem(string itemId, int quantity, long version)
{
if (_version.Value != version)
{
// Conflict
return (false, _version.Value);
}
if (quantity == 0)
{
cart.Remove(itemId);
}
else
{
cart[itemId] = quantity;
}
_version.Value++;
await WriteStateAsync();
return (true, _version.Value);
}
public ValueTask<(Dictionary<string, int> Contents, long Version)> GetCart() => new((cart.ToDictionary(), _version.Value));
public ValueTask<long> GetVersion() => new(_version.Value);
public async ValueTask<(bool success, long version)> Clear(long version)
{
if (_version.Value != version)
{
// Conflict
return (false, _version.Value);
}
cart.Clear();
_version.Value++;
await WriteStateAsync();
return (true, _version.Value);
}
}
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 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.
-
net8.0
- Azure.Core (>= 1.46.2)
- Azure.Storage.Blobs (>= 12.24.1)
- Microsoft.AspNetCore.Connections.Abstractions (>= 8.0.11)
- 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.11)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Orleans.Analyzers (>= 9.2.1)
- Microsoft.Orleans.CodeGenerator (>= 9.2.1)
- Microsoft.Orleans.Journaling (>= 9.2.1-alpha.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Collections.Immutable (>= 8.0.0)
- System.IO.Hashing (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- System.Memory.Data (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
9.2.1-alpha.1 | 428 | 7/16/2025 |
9.2.0-preview3.alpha.1 | 319 | 6/10/2025 |
9.2.0-preview2.alpha.1 | 126 | 6/4/2025 |
9.2.0-alpha.1 | 116 | 7/14/2025 |