akkadotnet / Akka.Hosting

Akka.Hosting - standardized Akka.NET hosting without any HOCON configuration. Ties into Microsoft.Extensions.Configuration, Logging, Hosting, and DependencyInjection.
Apache License 2.0
52 stars 13 forks source link

Akka.Cluster.Hosting: make it easy to add `ShardedDaemonProcess` #453

Closed Aaronontheweb closed 1 week ago

Aaronontheweb commented 1 month ago

Is your feature request related to a problem? Please describe.

Right now it's really awkward to access a ShardedDaemonProcess created through the usual Akka.NET syntax:

configurationBuilder.WithActors((system, registry, resolver) =>
{
    var shardedDaemonProcessSettings = ShardedDaemonProcessSettings.Create(system)
        .WithRole(options.ShardingOptions.Role);

    ShardedDaemonProcess.Get(system).Init("RecordProcessor", 1,
        i => resolver.Props<RecordProcessorActor>(), shardedDaemonProcessSettings, 
        PoisonPill.Instance);
});

What's really annoying about this is that we don't get an IActorRef back from this method - there's some additional methods involved in doing that, I believe.

Describe the solution you'd like

I would like to have something along the lines of

WithShardedDaemonProcess<TActor>(string typeName, int count, string role)

Which would allow me to use the ActorRegistry to resolve TActor and message the ShardedDaemonProcess directly.

Describe alternatives you've considered

One thing that occurs to me now is that it might be the the ShardedDaemonProcess was always designed for work-pulling only, which is another problem we'd have to deal with in the main Akka.NET repo itself.

Aaronontheweb commented 1 week ago

This was done as part of Akka.Hosting v1.5.24.