Class LoadBalancerResource

java.lang.Object
org.keycloak.services.resources.LoadBalancerResource

@Path("/lb-check") public class LoadBalancerResource extends Object
Prepare information for the load balancer (possibly in a multi-site setup) whether this Keycloak cluster should receive traffic.

This is non-blocking, so that the load balancer can still retrieve the status even if the Keycloak instance is trying to withstand a high load. See LoadBalancerCheckProvider.isDown() for a longer explanation.

Author:
Alexander Schwartz
  • Field Details

    • logger

      protected static final org.jboss.logging.Logger logger
  • Constructor Details

    • LoadBalancerResource

      public LoadBalancerResource()
  • Method Details

    • getStatusForLoadBalancer

      @GET @Produces("text/plain; charset=utf-8") public jakarta.ws.rs.core.Response getStatusForLoadBalancer()
      Return the status for a laod balancer in a multi-site setup if this Keycloak site should receive traffic.

      While a loadbalancer will usually check for the returned status code, the additional text UP or DOWN is returned for humans to see the status in the browser.

      In contrast to other management endpoints of Quarkus, no information is returned to the caller about the internal state of Keycloak as this endpoint might be publicly available from the internet and should return as little information as possible.

      Returns:
      HTTP status 503 and DOWN when down, and HTTP status 200 and UP when up.