akka net aspire configuration

Other Community

Skill notes

When to Use This Skill

Use this skill when: Setting up a new Akka.NET project with .NET Aspire orchestration Configuring Akka.Cluster with cluster bootstrapping and discovery Integrating Akka.Persistence with SQL Server Setting up Akka.Management for cluster management

akka-net-management - Deep dive into Akka.Management, Cluster Bootstrap, and discovery providers (Kubernetes, Azure, Config) microsoft-extensions-configuration - IValidateOptions patterns for configuration validation akka-net-best-practices - Cluster/local mode abstractions for testable actor systems aspire-integration-testing - Testing Aspire applications with real infrastructure

Core Principles

Configuration via Microsoft.Extensions.Configuration - Use strongly-typed settings classes bound from appsettings.json (see microsoft-extensions-configuration skill) Akka.Hosting for DI Integration - Use the Akka.Hosting library for seamless ASP.NET Core integration Aspire for Orchestration - Let Aspire manage service dependencies, networking, and environment configuration Health Checks - Always configure health checks for clustering, persistence, and readiness

Configuration Model (AkkaSettings.cs)

Create a strongly-typed configuration class:

Pattern 3: Health Checks

Always configure health checks in Program.cs:

Fluxly profile Runtime and permissions are inferred by Fluxly static checks, not author declarations or runtime test results.
Domain
Other
Author-declared agents
No explicit declaration found; this is not inferred or tested compatibility
Static check
88 / 100 · heuristic scan, not runtime safety proof
Runtime evidence
Not run; no isolated runtime test evidence is currently recorded
Author / version / license
@Aaronontheweb · no license declared
Token usage
Moderate
Setup complexity
Guided setup
External API key
Not required
Operating systems
macOS · Linux · Windows
Runtime requirements
Node.js
Detected file/system behavior
  • Read-only
  • Write / modify
  • Shell exec
  • Env read
Network behavior
Local-only
Install commands
None (reference only)

Heads up: Tool permissions are not declared; actual access depends on the runtime.

Output preview akka-net-aspire-configuration.preview
# Quick Example: Testing Akka + Aspire Integration

// Use Aspire's DistributedApplicationTestingBuilder for infrastructure
// Use Akka.Hosting.TestKit for actor testing
public class AkkaAspireIntegrationTests : IAsyncLifetime
{
    private DistributedApplication? _app;

    public async Task InitializeAsync()
    {
        var appHost = await DistributedApplicationTestingBuilder
            .CreateAsync<Projects.YourApp_AppHost>();

        _app = await appHost.BuildAsync();
        await _app.StartAsync();
    }

    [Fact]
    public async Task ActorSystem_WithRealDatabase_ShouldPersistEvents()
    {
        // Get SQL connection string from Aspire
        var dbResource = _app!.GetResource("yourdb");
        var connectionString = await dbResource.GetConnectionStringAsync();

        // Create HttpClient to test actor endpoints
        var httpClient = _app.CreateHttpClient("yourapp");

        // Test actor behavior through HTTP API
        var response = await httpClient.PostAsJsonAsync("/orders", new
        {
            OrderId = "ORDER-001",
            Amount = 100.00m
        });

        response.Should().BeSuccessStatusCode();

        // Verify data was persisted to real database
        await using var connection = new SqlConnection(connectionString);
        await connection.OpenAsync();

        var events = await connection.QueryAsync<string>(
            "SELECT EventType FROM EventJournal WHERE PersistenceId = 'order-ORDER-001'");

        events.Should().Contain("OrderCreated");
    }

    public async Task DisposeAsync()
    {
        if (_app is not null)
            await _app.DisposeAsync();
    }
}

Discussion

Powered by GitHub Discussions. Sign in with GitHub to comment, react, or subscribe.