public ElasticTaskExecutorHostedService( TaskExecutionContext executionContext, ElasticTaskExecutorHostServiceOptions option) { _executionContext = executionContext; _waitForExecutorTaskComplete = option.WaitForExecutorTaskComplete; _subscribers = option.Subscribers; }
public static IServiceCollection AddElasticTaskExecutorServer( this IServiceCollection services, Action <IServiceProvider, ElasticTaskExecutorHostServiceOptions> configurate) { return(services.AddSingleton(serviceProvider => { var option = new ElasticTaskExecutorHostServiceOptions(); configurate(serviceProvider, option); TaskExecutionContext context = null; if (option.EnableTaskPullerContext) { context = serviceProvider.GetRequiredService <TaskExecutionContext>(); } return (IHostedService) new ElasticTaskExecutorHostedService(context, option); })); }