Last active
May 11, 2018 18:27
-
-
Save AlonAm/541ea7571b46f7404818f8c3a8eecf89 to your computer and use it in GitHub Desktop.
AnyStatus Handler
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AnyStatus.API; | |
using System.Threading.Tasks; | |
public class MyHealthChecker : ICheckHealth<MyHealthCheck> | |
{ | |
public async Task Handle(HealthCheckRequest<MyHealthCheck> request, CancellationToken cancellationToken) | |
{ | |
var myHealthCheck = request.DataContext; | |
await Task.Delay(1).ConfigureAwait(false); | |
if (true) | |
{ | |
myHealthCheck.State = State.Ok; | |
} | |
else | |
{ | |
throw new Exception("My health check failed."); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment