public void ProcessRequest(HttpContext context) { try { Dictionary <string, CommandComponents> commandComponentsCollection = HystrixCommandBase.CommandComponentsCollection.ToDictionary(p => p.Key, p => p.Value); CHystrixConfigInfo config = new CHystrixConfigInfo() { ApplicationPath = HystrixCommandBase.ApplicationPath, CHystrixAppName = HystrixCommandBase.HystrixAppName, CHystrixVersion = HystrixCommandBase.HystrixVersion, MaxCommandCount = HystrixCommandBase.MaxCommandCount, CommandCount = commandComponentsCollection.Count, ConfigWebServiceUrl = HystrixConfigSyncManager.ConfigWebServiceUrl, SOARegistryServiceUrl = HystrixConfigSyncManager.SOARegistryServiceUrl, CHystrixConfigServiceUrl = HystrixCommandBase.ConfigServiceUrl, CHystrixRegistryServiceUrl = HystrixCommandBase.RegistryServiceUrl, SyncCHystrixConfigIntervalMilliseconds = HystrixConfigSyncManager.SyncConfigIntervalMilliseconds, SyncCommandConfigIntervalMilliseconds = CommandConfigSyncManager.SyncConfigIntervalMilliseconds, SelfRegistrationIntervalMilliseconds = SelfRegistrationManager.RegistrationIntervalMilliseconds, FrameworkDefaultCircuitBreakerRequestCountThreshold = ComponentFactory.FrameworkDefaultCircuitBreakerRequestCountThreshold, FrameworkDefaultCircuitBreakerErrorThresholdPercentage = ComponentFactory.FrameworkDefaultCircuitBreakerErrorThresholdPercentage, FrameworkDefaultCircuitBreakerForceClosed = ComponentFactory.FrameworkDefaultCircuitBreakerForceClosed, FrameworkDefaultCommandTimeoutInMilliseconds = ComponentFactory.FrameworkDefaultCommandTimeoutInMilliseconds, FrameworkDefaultSemaphoreIsolationMaxConcurrentCount = ComponentFactory.FrameworkDefaultSemaphoreIsolationMaxConcurrentCount, FrameworkDefaultThreadIsolationMaxConcurrentCount = ComponentFactory.FrameworkDefaultThreadIsolationMaxConcurrentCount, MinGlobalDefaultCircuitBreakerRequestCountThreshold = ComponentFactory.MinGlobalDefaultCircuitBreakerRequestCountThreshold, MinGlobalDefaultCircuitBreakerErrorThresholdPercentage = ComponentFactory.MinGlobalDefaultCircuitBreakerErrorThresholdPercentage, MinGlobalDefaultCommandTimeoutInMilliseconds = ComponentFactory.MinGlobalDefaultCommandTimeoutInMilliseconds, MinGlobalDefaultCommandMaxConcurrentCount = ComponentFactory.MinGlobalDefaultCommandMaxConcurrentCount, MinGlobalDefaultFallbackMaxConcurrentCount = ComponentFactory.MinGlobalDefaultFallbackMaxConcurrentCount, GlobalDefaultCircuitBreakerRequestCountThreshold = ComponentFactory.GlobalDefaultCircuitBreakerRequestCountThreshold, GlobalDefaultCircuitBreakerErrorThresholdPercentage = ComponentFactory.GlobalDefaultCircuitBreakerErrorThresholdPercentage, GlobalDefaultCircuitBreakerForceClosed = ComponentFactory.GlobalDefaultCircuitBreakerForceClosed, GlobalDefaultCommandTimeoutInMilliseconds = ComponentFactory.GlobalDefaultCommandTimeoutInMilliseconds, GlobalDefaultCommandMaxConcurrentCount = ComponentFactory.GlobalDefaultCommandMaxConcurrentCount, GlobalDefaultFallbackMaxConcurrentCount = ComponentFactory.GlobalDefaultFallbackMaxConcurrentCount, DefaultCircuitBreakerRequestCountThreshold = ComponentFactory.DefaultCircuitBreakerRequestCountThreshold, DefaultCircuitBreakerErrorThresholdPercentage = ComponentFactory.DefaultCircuitBreakerErrorThresholdPercentage, DefaultCircuitBreakerForceClosed = ComponentFactory.DefaultCircuitBreakerForceClosed, DefaultCommandTimeoutInMilliseconds = ComponentFactory.DefaultCommandTimeoutInMilliseconds, DefaultSemaphoreIsolationMaxConcurrentCount = ComponentFactory.DefaultSemaphoreIsolationMaxConcurrentCount, DefaultThreadIsolationMaxConcurrentCount = ComponentFactory.DefaultThreadIsolationMaxConcurrentCount, CommandConfigInfoList = new List <CommandConfigInfo>() }; foreach (CommandComponents item in commandComponentsCollection.Values) { config.CommandConfigInfoList.Add(new CommandConfigInfo() { CommandKey = item.CommandInfo.CommandKey, GroupKey = item.CommandInfo.GroupKey, Domain = item.CommandInfo.Domain, Type = item.CommandInfo.Type, ConfigSet = item.ConfigSet as CommandConfigSet }); } config.CommandConfigInfoList = config.CommandConfigInfoList.Distinct().ToList(); context.Response.ContentType = HttpContentTypes.Json; context.Response.Write(config.ToJson()); } catch (Exception ex) { context.Response.ContentType = HttpContentTypes.PlainText; context.Response.Write(ex.Message); } }
public void ProcessRequest(HttpContext context) { try { Dictionary <string, CommandComponents> dictionary = HystrixCommandBase.CommandComponentsCollection.ToDictionary <KeyValuePair <string, CommandComponents>, string, CommandComponents>(p => p.Key, p => p.Value); CHystrixConfigInfo info = new CHystrixConfigInfo { ApplicationPath = HystrixCommandBase.ApplicationPath, CHystrixAppName = HystrixCommandBase.HystrixAppName, CHystrixVersion = HystrixCommandBase.HystrixVersion, MaxCommandCount = HystrixCommandBase.MaxCommandCount, CommandCount = dictionary.Count, ConfigWebServiceUrl = HystrixConfigSyncManager.ConfigWebServiceUrl, SOARegistryServiceUrl = HystrixConfigSyncManager.SOARegistryServiceUrl, CHystrixConfigServiceUrl = HystrixCommandBase.ConfigServiceUrl, CHystrixRegistryServiceUrl = HystrixCommandBase.RegistryServiceUrl, SyncCHystrixConfigIntervalMilliseconds = 0x927c0, SyncCommandConfigIntervalMilliseconds = 0x7530, SelfRegistrationIntervalMilliseconds = 0x124f80, FrameworkDefaultCircuitBreakerRequestCountThreshold = 20, FrameworkDefaultCircuitBreakerErrorThresholdPercentage = 50, FrameworkDefaultCircuitBreakerForceClosed = false, FrameworkDefaultCommandTimeoutInMilliseconds = 0x7530, FrameworkDefaultSemaphoreIsolationMaxConcurrentCount = 100, FrameworkDefaultThreadIsolationMaxConcurrentCount = 20, MinGlobalDefaultCircuitBreakerRequestCountThreshold = 10, MinGlobalDefaultCircuitBreakerErrorThresholdPercentage = 20, MinGlobalDefaultCommandTimeoutInMilliseconds = 0x1388, MinGlobalDefaultCommandMaxConcurrentCount = 50, MinGlobalDefaultFallbackMaxConcurrentCount = 50, GlobalDefaultCircuitBreakerRequestCountThreshold = ComponentFactory.GlobalDefaultCircuitBreakerRequestCountThreshold, GlobalDefaultCircuitBreakerErrorThresholdPercentage = ComponentFactory.GlobalDefaultCircuitBreakerErrorThresholdPercentage, GlobalDefaultCircuitBreakerForceClosed = ComponentFactory.GlobalDefaultCircuitBreakerForceClosed, GlobalDefaultCommandTimeoutInMilliseconds = ComponentFactory.GlobalDefaultCommandTimeoutInMilliseconds, GlobalDefaultCommandMaxConcurrentCount = ComponentFactory.GlobalDefaultCommandMaxConcurrentCount, GlobalDefaultFallbackMaxConcurrentCount = ComponentFactory.GlobalDefaultFallbackMaxConcurrentCount, DefaultCircuitBreakerRequestCountThreshold = ComponentFactory.DefaultCircuitBreakerRequestCountThreshold, DefaultCircuitBreakerErrorThresholdPercentage = ComponentFactory.DefaultCircuitBreakerErrorThresholdPercentage, DefaultCircuitBreakerForceClosed = ComponentFactory.DefaultCircuitBreakerForceClosed, DefaultCommandTimeoutInMilliseconds = ComponentFactory.DefaultCommandTimeoutInMilliseconds, DefaultSemaphoreIsolationMaxConcurrentCount = ComponentFactory.DefaultSemaphoreIsolationMaxConcurrentCount, DefaultThreadIsolationMaxConcurrentCount = ComponentFactory.DefaultThreadIsolationMaxConcurrentCount, CommandConfigInfoList = new List <CommandConfigInfo>() }; foreach (CommandComponents components in dictionary.Values) { CommandConfigInfo item = new CommandConfigInfo { CommandKey = components.CommandInfo.CommandKey, GroupKey = components.CommandInfo.GroupKey, Domain = components.CommandInfo.Domain, Type = components.CommandInfo.Type, ConfigSet = components.ConfigSet as CommandConfigSet }; info.CommandConfigInfoList.Add(item); } info.CommandConfigInfoList = info.CommandConfigInfoList.Distinct <CommandConfigInfo>().ToList <CommandConfigInfo>(); context.Response.ContentType = "application/json"; context.Response.Write(info.ToJson()); } catch (Exception exception) { context.Response.ContentType = "text/plain"; context.Response.Write(exception.Message); } }