private static IHystrixCommand CreateHystrixCommand(HystrixCommandIdentifier commandIdentifier) { var configurationServiceImplementation = ConfigurationManager.AppSettings[ConfigurationserviceimplementationAppsettingName]; var configurationService = configurationServiceImplementation != null && configurationServiceImplementation.Equals("HystrixJsonConfigConfigurationService", StringComparison.InvariantCultureIgnoreCase) ? (IHystrixConfigurationService) new HystrixJsonConfigConfigurationService(commandIdentifier) : (IHystrixConfigurationService) new HystrixWebConfigConfigurationService(commandIdentifier); 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)); }
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)); }