Search in sources :

Example 1 with ServingStatus

use of io.grpc.health.v1.HealthCheckResponse.ServingStatus in project grpc-java by grpc.

the class HealthServiceImpl method check.

@Override
public void check(HealthCheckRequest request, StreamObserver<HealthCheckResponse> responseObserver) {
    ServingStatus status = getStatus(request.getService());
    if (status == null) {
        responseObserver.onError(new StatusException(Status.NOT_FOUND));
    } else {
        HealthCheckResponse response = HealthCheckResponse.newBuilder().setStatus(status).build();
        responseObserver.onNext(response);
        responseObserver.onCompleted();
    }
}
Also used : StatusException(io.grpc.StatusException) ServingStatus(io.grpc.health.v1.HealthCheckResponse.ServingStatus) HealthCheckResponse(io.grpc.health.v1.HealthCheckResponse)

Aggregations

StatusException (io.grpc.StatusException)1 HealthCheckResponse (io.grpc.health.v1.HealthCheckResponse)1 ServingStatus (io.grpc.health.v1.HealthCheckResponse.ServingStatus)1