Exemple #1
0
        private static RegionEndpoint GetAwsRegionEndpoint(StepFunctionsConfig config)
        {
            var regionEndpoint = string.IsNullOrEmpty(config.AwsRegion)
                ? RegionEndpoint.EUWest1
                : RegionEndpoint.GetBySystemName(config.AwsRegion);

            return(regionEndpoint);
        }
Exemple #2
0
        internal StepFunctionsBuilder(IServiceCollection serviceCollectionCollection,
                                      StepFunctionsConfig stepFunctionsConfig,
                                      FileStoreFactoryConfig fileStoreFactoryConfig)
        {
            _fileStoreFactoryConfig = fileStoreFactoryConfig;
            Config            = stepFunctionsConfig;
            ServiceCollection = serviceCollectionCollection;

            ServiceCollection.AddSingleton(fileStoreFactoryConfig);
            ServiceCollection.AddSingleton(x => new FileStoreFactory(x));
        }
Exemple #3
0
        internal WorkerHostedService(IWorker worker,
                                     IHeartbeatManager heartbeatManager,
                                     StepFunctionsConfig config,
                                     AmazonStepFunctionsClient client,
                                     ILoggerFactory loggerFactory)
        {
            _heartbeatManager = heartbeatManager;
            _logger           = loggerFactory.CreateLogger <WorkerHostedService>();
            LoggerFactory     = loggerFactory;
            Client            = client;
            Worker            = worker;
            Config            = config;

            _logger.LogDebug($"Creating TaskWorkerHostedService: '{worker.ActivityName}'");
        }
Exemple #4
0
        public static IServiceCollection AddStepFunctions(this IServiceCollection services,
                                                          StepFunctionsConfig stepFunctionsConfig,
                                                          FileStoreFactoryConfig fileStoreFactoryConfig,
                                                          Action <StepFunctionsBuilder> builder)
        {
            ;
            var sfb = new StepFunctionsBuilder(services, stepFunctionsConfig, fileStoreFactoryConfig);

            builder(sfb);
            services.AddSingleton <HeartbeatHostedService>();
            services.AddTransient <IHeartbeatManager>(x => x.GetService <HeartbeatHostedService>());
            services.AddTransient <IHostedService>(x => x.GetService <HeartbeatHostedService>());
            services.AddSingleton(sfb.Config);
            services.AddTransient(GetAmazonStepFunctionsClient);

            return(services);
        }