public async Task <HealthCheckResult> CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default)
 {
     return(await _service.CheckIsHealthy(MaxMessageAge)
         ? new HealthCheckResult(HealthStatus.Healthy)
         : new HealthCheckResult(context.Registration.FailureStatus,
                                 $"The outbound queue exceeded the configured limits " +
                                 $"(max message age: {MaxMessageAge.ToString()}, " +
                                 $"max queue length: {MaxQueueLength?.ToString() ?? "-"})."));
 }
Ejemplo n.º 2
0
        public async Task Run()
        {
            Console.ForegroundColor = Constants.PrimaryColor;
            Console.WriteLine("Checking outbound queue (maxAge: 100ms, maxQueueLength: 1)...");
            ConsoleHelper.ResetColor();

            var result = await _service.CheckIsHealthy(TimeSpan.FromMilliseconds(100), 1);

            Console.ForegroundColor = Constants.PrimaryColor;
            Console.WriteLine($"Healthy: {result}");
            ConsoleHelper.ResetColor();
        }