public WorkflowTaskCoordinator(IServiceProvider serviceProvider,
                                ILogger <WorkflowTaskCoordinator> logger,
                                ConductorClientSettings conductorClientSettings)
 {
     _serviceProvider   = serviceProvider;
     _logger            = logger;
     _concurrentWorkers = conductorClientSettings.ConcurrentWorkers;
 }
 public WorkflowTaskExecutor(ITaskClient taskClient,
                             IServiceProvider serviceProvider,
                             ILogger <WorkflowTaskExecutor> logger,
                             ConductorClientSettings conductorClientSettings)
 {
     _taskClient              = taskClient;
     _serviceProvider         = serviceProvider;
     _logger                  = logger;
     _conductorClientSettings = conductorClientSettings;
 }
        public static IServiceCollection AddConductorWorker(this IServiceCollection services,
                                                            Func <IServiceProvider, string> serverUrl,
                                                            int concurrentWorkers = 1,
                                                            int sleepInterval     = 1000,
                                                            string domain         = default(string))
        {
            var conductorClientSettings = new ConductorClientSettings
            {
                Domain            = domain,
                IntervalStrategy  = ConductorClientSettings.IntervalStrategyType.Exponential,
                SleepInterval     = sleepInterval,
                ConcurrentWorkers = concurrentWorkers,
                ServerUrl         = new Uri(serverUrl(services.BuildServiceProvider()))
            };

            return(services.AddConductorWorker(conductorClientSettings));
        }
        public static IServiceCollection AddConductorWorker(this IServiceCollection services, ConductorClientSettings conductorClientSettings)
        {
            services.AddSingleton <ConductorClientSettings>(conductorClientSettings);

            services.AddHttpClient <IConductorRestClient, CustomConductorRestClient>((provider, client) =>
            {
                client.BaseAddress = conductorClientSettings.ServerUrl;
            });

            services.AddSingleton <IWorkflowTaskCoordinator, WorkflowTaskCoordinator>();
            services.AddTransient <ITaskClient, RestTaskClient>();
            services.AddTransient <IWorkflowTaskExecutor, WorkflowTaskExecutor>();

            return(services);
        }