java.lang.Object
grpc.health.v1.HealthGrpc.HealthImplBase
org.hansken.plugin.extraction.runtime.grpc.server.HealthService
All Implemented Interfaces:
HealthGrpc.AsyncService, io.grpc.BindableService

public class HealthService extends HealthGrpc.HealthImplBase
gRPC service that implements the gRPC Health Checking Protocol: https://github.com/grpc/grpc/blob/master/doc/health-checking.md This is used to perform a readiness check for the Extraction Plugin pod in Kubernetes. The health service will always return SERVING, no matter the requested service. This is sufficient for letting Hansken wait on Extraction Plugins that take a long time (i.e. 30 seconds) before they are ready. Note that Hansken will timeout after one minute.
Author:
Netherlands Forensic Institute
  • Constructor Details

    • HealthService

      public HealthService()
  • Method Details

    • check

      public void check(HealthOuterClass.HealthCheckRequest request, io.grpc.stub.StreamObserver<HealthOuterClass.HealthCheckResponse> responseObserver)
      Puts the status SERVING on the response. Kubernetes will probe this service to determine the readiness of the pod of the Extraction Plugin. A gRPC client (like Hansken) can wait until the pod is ready and only then continue to perform other gRPC calls.
      Parameters:
      request - the service to be checked, currently this is unused
      responseObserver - a gRPC StreamObserver that handles the response
    • watch

      public void watch(HealthOuterClass.HealthCheckRequest request, io.grpc.stub.StreamObserver<HealthOuterClass.HealthCheckResponse> responseObserver)
      A client can call the Watch method to perform a streaming health-check. The server will immediately send back a message indicating the current serving status. It will then subsequently send a new message whenever the service's serving status changes. This MVP implementation just returns SERVING and will not change status. TODO: Determine health/liveness by the number of threads in use by the Extraction Plugin (HANSKEN-16909)
      Parameters:
      request - the service to be checked, currently this is unused
      responseObserver - a gRPC StreamObserver that handles the response