public IEndpointHealthNotifier StartHealthNotifier()
        {
            if (_definition == null)
            {
                throw new InvalidOperationException("No endpoint definition provided");
            }

            if (_healthChecker == null)
            {
                throw new InvalidOperationException("No health checker provided");
            }

            if (_backOffStategy == null)
            {
                _backOffStategy = new RecommendedBackOffStrategy();
            }

            if (_client == null)
            {
                return(null);
            }

            _logger.Info("Starting Health Monitor integration...");

            return(new EndpointHealthNotifier(_client, _timeCoordinator, _definition, _healthChecker, _backOffStategy));
        }
 public EndpointHealthNotifier(
     IHealthMonitorClient client,
     ITimeCoordinator timeCoordinator,
     EndpointDefinition definition,
     IHealthChecker healthChecker,
     IBackOffStategy backOffStategy)
 {
     _client                 = client;
     _timeCoordinator        = timeCoordinator;
     _definition             = definition;
     _healthChecker          = healthChecker;
     _backOffStategy         = backOffStategy;
     _cancelationTokenSource = new CancellationTokenSource();
     _healthCheckInterval    = new CachedValue <TimeSpan>(HealthCheckIntervalCacheDuration, GetHealthCheckIntervalAsync);
     _thread                 = new Thread(HealthLoop)
     {
         IsBackground = true, Name = "Health Check loop"
     };
     _thread.Start();
 }
 public HealthMonitorPushClient WithBackOffStategy(IBackOffStategy backOffStategy)
 {
     _backOffStategy = backOffStategy;
     return(this);
 }