akkadotnet/Akka.Hosting

Finer grain control over ActorSystem startup

Arkatufus opened this issue · 1 comments

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

Right now, there is no proper programmatic way to defer/modify ActorSystem hosted service startup, everything is started immediately on host application start up.

Describe the solution you'd like

A way for users to modify/override the IHostedService.StartAsync() and IHostedService.StopAsync() methods.

Possible solution:

  • Convert AkkaHostingService to public abstract and expose some of the properties as protected.
  • Add a new AddAkka extension method that have this method fingerprint:
          public static IServiceCollection AddAkka<T>(
              this IServiceCollection services,
              string actorSystemName,
              Action<AkkaConfigurationBuilder, IServiceProvider> builder)
              where T: AkkaHostedService