Aaron.Akka.Aspire 0.1.0

dotnet add package Aaron.Akka.Aspire --version 0.1.0
                    
NuGet\Install-Package Aaron.Akka.Aspire -Version 0.1.0
                    
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="Aaron.Akka.Aspire" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aaron.Akka.Aspire" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Aaron.Akka.Aspire" />
                    
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 Aaron.Akka.Aspire --version 0.1.0
                    
#r "nuget: Aaron.Akka.Aspire, 0.1.0"
                    
#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 Aaron.Akka.Aspire@0.1.0
                    
#: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=Aaron.Akka.Aspire&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Aaron.Akka.Aspire&version=0.1.0
                    
Install as a Cake Tool

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 clustering
  • Akka__Cluster__RemotePort / Akka__Cluster__ManagementPort - unique ports per replica
  • Akka__Cluster__PublicHostName / Akka__Cluster__ServiceName - discovery identity
  • Akka__Cluster__RequiredContactPointsNr - derived from replica count
  • Akka__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

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 - IServiceCollection integration 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

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.0 86 2/6/2026

Initial release of Akka.NET Aspire hosting plugin packages:

**Packages:**
* `Aaron.Akka.Aspire.Hosting` - AppHost integration for configuring Akka.NET clusters in .NET Aspire
* `Aaron.Akka.Aspire` - Client/service-side Akka.NET Aspire cluster bootstrap
* `Aaron.Akka.Discovery.Redis` - Redis-based service discovery plugin for Akka.NET

**Features:**
* Health checks for cluster membership and actor system liveness via ASP.NET health check infrastructure [#3](https://github.com/Aaronontheweb/akka.net-aspire-plugin/pull/3)
* Flexible discovery provider configuration via `configureDiscovery` callback parameter in `WithAspireClusterBootstrap` [#10](https://github.com/Aaronontheweb/akka.net-aspire-plugin/pull/10)
* Azure Table Storage discovery sample project demonstrating multi-provider portability [#10](https://github.com/Aaronontheweb/akka.net-aspire-plugin/pull/10)
* Working Redis-based sample application with 3 replicas demonstrating cluster formation
* Comprehensive documentation covering architecture, configuration, and deployment scenarios [#9](https://github.com/Aaronontheweb/akka.net-aspire-plugin/pull/9)
* Full Akka.Hosting extension method integration (no raw HOCON required)

**Bug Fixes:**
* Fixed cluster bootstrap: replicas can now properly discover each other and form clusters [#7](https://github.com/Aaronontheweb/akka.net-aspire-plugin/pull/7)
 - Resolved SelfAwareJoinDecider hostname mismatch between management config and discovery targets
 - Each replica now registers unique `(hostname, port)` tuple in Redis discovery
* Added OpenTelemetry integration for Aspire dashboard visibility

**Technical Details:**
* Akka.Management 1.5.59+ (cluster bootstrap folded into core `Akka.Management` package)
* Supports .NET 10.0 (Hosting + Client packages), netstandard2.0/net9.0/net10.0 (Redis discovery)
* Integration tests verify cluster formation with Docker/Redis (~15s for 3 replicas)
* Code quality checks via slopwatch [#5](https://github.com/Aaronontheweb/akka.net-aspire-plugin/pull/5)