Skip to main content
net10.0

.NET Aspire hosting integration for Akka.NET clusters. Provides AddAkka(), WithClustering(), and WithReference() for configuring Akka.NET in .NET Aspire AppHost projects.

Published
Oct 7, 2026
12d ago
Total Downloads
599
599

Install

dotnet add package Akka.Aspire.Hosting --version 1.6.0-beta3
ProductVersions
.NET
net10.0

README

Akka.Aspire.Hosting

.NET Aspire hosting integration for Akka.NET clusters. Add it to your Aspire AppHost to declare a cluster's topology — discovery backend, replica count, ports — and every service replica wired with WithReference will automatically discover its peers, form a cluster, and report health.

Pair it with the service-side Akka.Aspire package, which reads the configuration this package injects.

Installation

dotnet add package Akka.Aspire.Hosting

Usage (AppHost)

using Akka.Aspire.Hosting;

var builder = DistributedApplication.CreateBuilder(args);

// A discovery-backend Aspire resource (Redis here; Azure Table Storage is also supported)
var redis = builder.AddRedis("akka-discovery");

// Declare the Akka.NET cluster and bind its discovery backend
var akka = builder.AddAkka("my-cluster")
    .WithClustering(redis);

// Wire the cluster into a replicated service
builder.AddProject<Projects.MyService>("service")
    .WithHttpEndpoint(name: "http")
    .WithReplicas(3)
    .WithReference(akka);

builder.Build().Run();

AddAkka declares the cluster; WithClustering(resource) binds the discovery backend (the provider type is auto-detected from the resource — e.g. Redis, AzureTableStorage); and WithReference(akka) injects the resulting configuration into each service replica.

What it injects

WithReference(akka) sets these environment variables on each replica, which the service-side Akka.Aspire package reads via IConfiguration:

Variable Purpose
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 the replica count
Akka__Cluster__Clustering__ProviderType Auto-detected from the resource type
Akka__Cluster__Clustering__ConnectionStringName The Aspire resource name for the discovery backend
ConnectionStrings__<name> The connection string for that backend

Supported discovery backends

Complete Redis and Azure Table Storage samples live under src/aspire/examples/ in the Akka.Management repository.

Learn more

License

Apache-2.0

Changes from Previous Version

No structural changes between v1.5.73 and v1.6.0-beta3.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.