public HystrixCommandConfiguration(IHystrixCommandKey commandKey, IHystrixThreadPoolKey threadPoolKey, IHystrixCommandGroupKey groupKey,
                                    HystrixCommandExecutionConfig executionConfig,
                                    HystrixCommandCircuitBreakerConfig circuitBreakerConfig,
                                    HystrixCommandMetricsConfig metricsConfig)
 {
     this.commandKey           = commandKey;
     this.threadPoolKey        = threadPoolKey;
     this.groupKey             = groupKey;
     this.executionConfig      = executionConfig;
     this.circuitBreakerConfig = circuitBreakerConfig;
     this.metricsConfig        = metricsConfig;
 }
示例#2
0
        public static HystrixCommandConfiguration Sample(
            IHystrixCommandKey commandKey,
            IHystrixThreadPoolKey threadPoolKey,
            IHystrixCommandGroupKey groupKey,
            IHystrixCommandOptions commandProperties)
        {
            var executionConfig = new HystrixCommandExecutionConfig(
                commandProperties.ExecutionIsolationSemaphoreMaxConcurrentRequests,
                commandProperties.ExecutionIsolationStrategy,
                false,
                commandProperties.ExecutionIsolationThreadPoolKeyOverride,
                commandProperties.ExecutionTimeoutEnabled,
                commandProperties.ExecutionTimeoutInMilliseconds,
                commandProperties.FallbackEnabled,
                commandProperties.FallbackIsolationSemaphoreMaxConcurrentRequests,
                commandProperties.RequestCacheEnabled,
                commandProperties.RequestLogEnabled);

            var circuitBreakerConfig = new HystrixCommandCircuitBreakerConfig(
                commandProperties.CircuitBreakerEnabled,
                commandProperties.CircuitBreakerErrorThresholdPercentage,
                commandProperties.CircuitBreakerForceClosed,
                commandProperties.CircuitBreakerForceOpen,
                commandProperties.CircuitBreakerRequestVolumeThreshold,
                commandProperties.CircuitBreakerSleepWindowInMilliseconds);

            var metricsConfig = new HystrixCommandMetricsConfig(
                commandProperties.MetricsHealthSnapshotIntervalInMilliseconds,
                commandProperties.MetricsRollingPercentileEnabled,
                commandProperties.MetricsRollingPercentileWindowBuckets,
                commandProperties.MetricsRollingPercentileWindowInMilliseconds,
                commandProperties.MetricsRollingStatisticalWindowBuckets,
                commandProperties.MetricsRollingStatisticalWindowInMilliseconds);

            return(new HystrixCommandConfiguration(
                       commandKey, threadPoolKey, groupKey, executionConfig, circuitBreakerConfig, metricsConfig));
        }