Class DatabaseHealthIndicator

java.lang.Object
com.kingsrook.qqq.middleware.health.indicators.DatabaseHealthIndicator
All Implemented Interfaces:
HealthIndicator

public class DatabaseHealthIndicator extends Object implements HealthIndicator
Health indicator that checks database connectivity and connection pool health. This indicator: - Executes a simple query (SELECT 1) to verify database is reachable - Checks connection pool statistics if available - Reports status as UP if query succeeds, DOWN if it fails
  • Constructor Details

    • DatabaseHealthIndicator

      public DatabaseHealthIndicator()
      Constructor
  • Method Details

    • getName

      public String getName()
      Get the name of this health indicator
      Specified by:
      getName in interface HealthIndicator
      Returns:
      indicator name (e.g., "database", "memory", "diskSpace")
    • check

      public HealthCheckResult check(QInstance qInstance) throws QException
      Execute the database health check
      Specified by:
      check in interface HealthIndicator
      Parameters:
      qInstance - the QInstance for accessing backends, configuration, etc.
      Returns:
      health check result with status and details
      Throws:
      QException - if the check fails catastrophically
    • withBackendName

      public DatabaseHealthIndicator withBackendName(String backendName)
      Fluent setter for backendName
    • withTimeout

      public DatabaseHealthIndicator withTimeout(Integer timeoutMs)
      Fluent setter for timeoutMs
    • getBackendName

      public String getBackendName()
      Getter for backendName
    • setBackendName

      public void setBackendName(String backendName)
      Setter for backendName
    • getTimeoutMs

      public Integer getTimeoutMs()
      Getter for timeoutMs
    • setTimeoutMs

      public void setTimeoutMs(Integer timeoutMs)
      Setter for timeoutMs