OrleansContrib / Orleans.SyncWork

This package's intention is to expose an abstract base class to allow https://github.com/dotnet/orleans/ to work with long running CPU bound synchronous work, without becoming overloaded.
https://OrleansContrib.github.io/Orleans.SyncWork
MIT License
58 stars 12 forks source link

Introduce "bootstrapping" extension method for `ISiloBuilder`, like the one existing for `ISiloHostBuilder` #33

Closed Kritner closed 2 years ago

Kritner commented 2 years ago

Is your feature request related to a problem? Please describe. The ISiloHostBuilder will seemingly be obsoleted/deprecated at some point as per https://github.com/dotnet/orleans/issues/5685.

Describe the solution you'd like Introduce an extension method onto ISiloBuilder that will allow a similar registration of the Orleans.SyncWork requirements such as the ApplicationParts and LimitedConcurrencyLevelTaskScheduler.

Describe alternatives you've considered n/a

Additional context Both the ISiloBuilder and ISiloHostBuilder extension methods will exist together.

Should closely resemble the current ISiloHostBuilder extension method located here: https://github.com/OrleansContrib/Orleans.SyncWork/blob/v1.4.10/src/Orleans.SyncWork/ExtensionMethods/SiloHostBuilderExtensions.cs

public static ISiloHostBuilder ConfigureSyncWorkAbstraction(this ISiloHostBuilder builder, int maxSyncWorkConcurrency = 4)
{
    builder.ConfigureApplicationParts(parts => parts.AddApplicationPart(typeof(ISyncWorkAbstractionMarker).Assembly).WithReferences());

    builder.ConfigureServices(services =>
    {
        services.AddSingleton(_ => new LimitedConcurrencyLevelTaskScheduler(maxSyncWorkConcurrency));
    });

    return builder;
}