public ElasticTaskExecutorHostedService(
     TaskExecutionContext executionContext,
     ElasticTaskExecutorHostServiceOptions option)
 {
     _executionContext            = executionContext;
     _waitForExecutorTaskComplete = option.WaitForExecutorTaskComplete;
     _subscribers = option.Subscribers;
 }
コード例 #2
0
 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);
     }));
 }