public void Start(TextWriter inputWriter) { _httpClient = HttpHealthCheckClient.Create(); var reporter = new HealthCheckReporter(inputWriter); JsonDataExtractor extractor = null; if (!string.IsNullOrWhiteSpace(DataExtractionExpression)) { extractor = new JsonDataExtractor(DataExtractionExpression); } var targetUrls = TargetUrl.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); foreach (var targetUrl in targetUrls) { var healthCheck = new HttpHealthCheck( _httpClient, App.Title, targetUrl, extractor, BypassHttpCaching); _healthCheckTasks.Add(new HealthCheckTask( healthCheck, TimeSpan.FromSeconds(IntervalSeconds), reporter, Log)); } }
public HttpHealthCheck(HttpClient httpClient, string title, string targetUrl, JsonDataExtractor extractor) { _httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); _title = title ?? throw new ArgumentNullException(nameof(title)); _targetUrl = targetUrl ?? throw new ArgumentNullException(nameof(targetUrl)); _extractor = extractor; }