Aaron.Akka.Discovery.Redis
0.2.0
dotnet add package Aaron.Akka.Discovery.Redis --version 0.2.0
NuGet\Install-Package Aaron.Akka.Discovery.Redis -Version 0.2.0
<PackageReference Include="Aaron.Akka.Discovery.Redis" Version="0.2.0" />
<PackageVersion Include="Aaron.Akka.Discovery.Redis" Version="0.2.0" />
<PackageReference Include="Aaron.Akka.Discovery.Redis" />
paket add Aaron.Akka.Discovery.Redis --version 0.2.0
#r "nuget: Aaron.Akka.Discovery.Redis, 0.2.0"
#:package Aaron.Akka.Discovery.Redis@0.2.0
#addin nuget:?package=Aaron.Akka.Discovery.Redis&version=0.2.0
#tool nuget:?package=Aaron.Akka.Discovery.Redis&version=0.2.0
Akka.NET Aspire Plugin
Automated Akka.NET cluster formation for .NET Aspire. Configure your cluster topology in the AppHost, and each service replica will automatically discover peers, form a cluster, and report health status.
Packages
| Package | Target | Description |
|---|---|---|
Aaron.Akka.Aspire.Hosting |
net10.0 | AppHost-side: AddAkka(), WithClustering(), WithReference() |
Aaron.Akka.Aspire |
net10.0 | Service-side: WithAspireClusterBootstrap() reads Aspire-injected config |
Aaron.Akka.Discovery.Redis |
netstandard2.0; net9.0; net10.0 | Redis-based service discovery plugin |
Usage
AppHost
using Aaron.Akka.Aspire.Hosting;
var builder = DistributedApplication.CreateBuilder(args);
var redis = builder.AddRedis("akka-discovery");
var akka = builder.AddAkka("my-cluster")
.WithClustering(redis);
builder.AddProject<Projects.MyService>("service")
.WithHttpEndpoint(name: "http")
.WithReplicas(3)
.WithReference(akka);
builder.Build().Run();
Service (Redis Discovery)
using Aaron.Akka.Aspire;
using Aaron.Akka.Discovery.Redis;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAkka("MySystem", (akkaBuilder, sp) =>
{
akkaBuilder.WithAspireClusterBootstrap(sp,
configureDiscovery: (b, config) =>
{
var redisConn = config.GetConnectionString("akka-discovery");
if (!string.IsNullOrEmpty(redisConn))
b.WithRedisDiscovery(redisConn, config["Akka:Cluster:ServiceName"]);
},
clusterConfigure: c => c.Roles = ["my-service"]);
});
builder.Services.AddHealthChecks();
var app = builder.Build();
app.MapHealthChecks("/healthz");
app.MapGet("/", () => "Hello from Akka.NET!");
app.Run();
WithAspireClusterBootstrap configures Akka.Remote, Akka.Cluster, Akka.Management, Cluster Bootstrap, and health checks from the environment variables that the hosting package injects. The configureDiscovery callback wires up the discovery plugin using the same IConfiguration that Aspire populates. No manual HOCON needed.
How It Works
The hosting package (WithReference(akka)) injects environment variables into each service replica:
Akka__Cluster__Enabled- enables clusteringAkka__Cluster__RemotePort/Akka__Cluster__ManagementPort- unique ports per replicaAkka__Cluster__PublicHostName/Akka__Cluster__ServiceName- discovery identityAkka__Cluster__RequiredContactPointsNr- derived from replica countAkka__Cluster__Clustering__ProviderType- auto-detected from the resource type (e.g.Redis,AzureTableStorage)Akka__Cluster__Clustering__ConnectionStringName- the Aspire resource name for the discovery backend- Connection string for the discovery backend (e.g.
ConnectionStrings__akka-discovery)
The service-side bootstrap reads these via IConfiguration, configures the full Akka.NET cluster stack, and uses the discovery plugin to find other replicas. Cluster Bootstrap's SelfAwareJoinDecider handles initial seed node election.
Supported Discovery Providers
- Redis (
Aaron.Akka.Discovery.Redis) - each node registers in Redis with a heartbeat - Azure Table Storage (
Akka.Discovery.Azure) - uses Azure Table Storage for node registration - Kubernetes (
Akka.Discovery.KubernetesApi) - queries the Kubernetes API for pod endpoints - Config - static seed nodes (default fallback)
Production Deployment
The configureDiscovery callback makes it straightforward to swap discovery providers between environments. Only the AppHost and the callback change -- the rest of the service code stays identical.
Azure Table Storage (local dev with Azurite, production with real Azure)
AppHost:
var storage = builder.AddAzureStorage("azure-storage").RunAsEmulator();
var tables = storage.AddTables("akka-discovery");
var akka = builder.AddAkka("my-cluster")
.WithClustering(tables);
Service:
akkaBuilder.WithAspireClusterBootstrap(sp,
configureDiscovery: (b, config) =>
{
var azureConn = config.GetConnectionString("akka-discovery");
if (!string.IsNullOrEmpty(azureConn))
b.WithAzureDiscovery(azureConn, config["Akka:Cluster:ServiceName"]);
},
clusterConfigure: c => c.Roles = ["my-service"]);
Kubernetes (no connection string needed)
Service:
akkaBuilder.WithAspireClusterBootstrap(sp,
configureDiscovery: (b, config) =>
{
b.WithKubernetesDiscovery();
},
clusterConfigure: c => c.Roles = ["my-service"]);
See the samples/ directory for complete working examples with Redis and Azure Table Storage.
Learn More
- Akka.NET Clustering - how Akka.NET clusters work, membership lifecycle, and seed node discovery
- Akka.Management - HTTP management endpoint and Cluster Bootstrap for automated cluster formation
- Akka.Hosting -
IServiceCollectionintegration for configuring Akka.NET without raw HOCON - .NET Aspire - orchestration, service discovery, and telemetry for distributed .NET apps
Building
dotnet tool restore
dotnet build -c Release
dotnet test -c Release
dotnet pack -c Release -o ./bin/nuget
Integration tests require Docker (they spin up a Redis container via Aspire).
License
Apache-2.0
Pinning Actions to SHAs
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 is compatible. 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 is compatible. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Akka (>= 1.5.60)
- Akka.Discovery (>= 1.5.59)
- Akka.Hosting (>= 1.5.59)
- StackExchange.Redis (>= 2.10.14)
- System.Text.Json (>= 10.0.2)
-
net10.0
- Akka (>= 1.5.60)
- Akka.Discovery (>= 1.5.59)
- Akka.Hosting (>= 1.5.59)
- StackExchange.Redis (>= 2.10.14)
-
net9.0
- Akka (>= 1.5.60)
- Akka.Discovery (>= 1.5.59)
- Akka.Hosting (>= 1.5.59)
- StackExchange.Redis (>= 2.10.14)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Aaron.Akka.Discovery.Redis:
| Repository | Stars |
|---|---|
|
petabridge/DrawTogether.NET
Multi-player MS Paint application. Built with Akka.NET, Blazor, and .NET Aspire.
|
**Security:**
- Updated OpenTelemetry packages to 1.15.x — patches 4 known vulnerabilities (GHSA-g94r-2vxg-569j, GHSA-4625-4j76-fww9, GHSA-mr8r-92fq-pj8p, GHSA-q834-8qmm-v933)
**Dependencies:**
- .NET Aspire updated to 13.3.5
- Akka.NET updated to 1.5.60
- Akka.Hosting updated to 1.5.59 (with cluster bootstrap folded into core)
- Akka.Cluster.Hosting updated to 1.5.59