public HystrixCommandFactory(HystrixOptions options) { if (options == null) { throw new ArgumentException("The HystrixOptions must be specified in order to use Hystrix.Dotnet", nameof(options)); } this.options = options; }
private static IHystrixCommand CreateHystrixCommand(HystrixCommandIdentifier commandIdentifier, HystrixOptions options) { var configurationServiceImplementation = options.ConfigurationServiceImplementation; var configurationService = configurationServiceImplementation != null && configurationServiceImplementation.Equals("HystrixJsonConfigConfigurationService", StringComparison.OrdinalIgnoreCase) ? (IHystrixConfigurationService) new HystrixJsonConfigConfigurationService(commandIdentifier, options.JsonConfigurationSourceOptions) : new HystrixLocalConfigurationService(commandIdentifier, options.LocalOptions); var commandMetrics = new HystrixCommandMetrics(commandIdentifier, configurationService); var timeoutWrapper = new HystrixTimeoutWrapper(commandIdentifier, configurationService); var circuitBreaker = new HystrixCircuitBreaker(commandIdentifier, configurationService, commandMetrics); var threadPoolMetrics = new HystrixThreadPoolMetrics(commandIdentifier, configurationService); return(new HystrixCommand(commandIdentifier, timeoutWrapper, circuitBreaker, commandMetrics, threadPoolMetrics, configurationService)); }