public HystrixStreamHandler() { int pollingInterval; if (!int.TryParse(ConfigurationManager.AppSettings[PollingIntervalInMilliseconds], out pollingInterval)) { pollingInterval = 500; } Log.InfoFormat("Creating HystrixStreamHandler with interval {0}", pollingInterval); endpoint = new HystrixMetricsStreamEndpoint(new HystrixCommandFactory(), pollingInterval); }
public HystrixStreamHandler() { var configSection = ConfigurationManager.GetSection("hystrix.dotnet/hystrix") as HystrixConfigSection; int pollingInterval = configSection?.MetricsStreamPollIntervalInMilliseconds ?? 500; log.InfoFormat("Creating HystrixStreamHandler with interval {0}", pollingInterval); var helper = new AspNetHystrixCommandFactoryHelper(); endpoint = new HystrixMetricsStreamEndpoint( helper.CreateFactory(), pollingInterval); }
public async Task Invoke(HttpContext context, IHystrixMetricsStreamEndpoint streamEndpoint) { log.Info("Starting HystrixStreamHandler request"); var response = context.Response; // Do not cache response.Headers.Add("Cache-Control", "no-cache"); response.Headers.Add("Expires", "-1"); response.Headers.Add("Pragma", "no-cache"); response.ContentType = "text/event-stream"; await streamEndpoint.PushContentToOutputStream(response.Body, () => { }, context.RequestAborted).ConfigureAwait(false); log.Info("Ending HystrixStreamMiddleware request"); }