orleans icon indicating copy to clipboard operation
orleans copied to clipboard

Nats + Aspire Configuration

Open KRTone opened this issue 7 months ago • 0 comments

Could you explain how to configure Orleans Streaming using NATS and hosting it on Aspire?

NATS/Aspire: https://aspire.dev/integrations/messaging/nats/nats-host/ Streaming.NATS: https://github.com/dotnet/orleans/blob/main/src/Orleans.Streaming.NATS

All time getting error from SILO CO-HOSTED project: System.InvalidOperationException: 'Could not find Streaming provider named 'NatsServer'. This can indicate that either the 'Microsoft.Orleans.Sdk' or the provider's package are not referenced by your application. Known Streaming providers: Memory.

SILO:

builder.UseOrleans(siloBuilder =>
{
    //....
    siloBuilder.AddNatsStreams(Constants.StreamProvider, nats =>
    {
        nats.StreamName = Constants.StreamProvider;
    });
});

Aspire:

var builder = DistributedApplication.CreateBuilder(args);
var nats = builder.AddNats(Constants.StreamProvider);

var orleans = builder.AddOrleans("cluster")
    //....
    .WithStreaming(Constants.StreamProvider, nats);


var silo = builder.AddProject<Projects.Silo>("silo")
    .WithReference(orleans)
    .WithReference(nats)
    .WithReplicas(3);

builder.Build().Run();

KRTone avatar Apr 17 '26 14:04 KRTone