Class DbClientHealthCheck.Builder

java.lang.Object
io.helidon.dbclient.health.DbClientHealthCheck.Builder
All Implemented Interfaces:
Builder<DbClientHealthCheck.Builder,DbClientHealthCheck>, Supplier<DbClientHealthCheck>
Enclosing class:
DbClientHealthCheck

public static final class DbClientHealthCheck.Builder extends Object implements Builder<DbClientHealthCheck.Builder,DbClientHealthCheck>
Fluent API builder for DbClientHealthCheck. Default health check setup will call named DML statement with name ping. This named DML statement shall be configured in statements section of the DBClient configuration file.
  • Method Details

    • build

      public DbClientHealthCheck build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<DbClientHealthCheck.Builder,DbClientHealthCheck>
      Returns:
      instance of the built type
    • name

      public DbClientHealthCheck.Builder name(String name)
      Customized name of the health check. Default uses DbClient.dbType().
      Parameters:
      name - name of the health check
      Returns:
      updated builder instance
    • config

      public DbClientHealthCheck.Builder config(Config config)
      Set health check parameters using Config node.

      Configuration node expected content:

      • name: custom health check name.
      • type: statement type (default value is query).
      • statement: statement to be executed in database.
      • statementName: name of statement to be executed in database. Statement with given name must exist in statements Config node.
      • timeout: timeout value.
      • timeUnit: units of timeout value (default value is seconds).
      Only one of statement and statementName parameters is allowed.
      Parameters:
      config - Config instance with health check parameters
      Returns:
      updated builder instance
    • query

      Set health check statement type to query. Allows to override value set in Config node. Default health check statement type is query.
      Returns:
      updated builder instance
    • dml

      Set health check statement type to DML. Allows to override value set in Config node. Default health check statement type is query.
      Returns:
      updated builder instance
    • statementName

      public DbClientHealthCheck.Builder statementName(String name)
      Set custom statement name. Default statement name value is ping.
      Parameters:
      name - custom statement name.
      Returns:
      updated builder instance
    • statement

      public DbClientHealthCheck.Builder statement(String statement)
      Set custom statement.
      Parameters:
      statement - custom statement name.
      Returns:
      updated builder instance
    • timeout

      public DbClientHealthCheck.Builder timeout(long duration, TimeUnit timeUnit)
      Set custom timeout to wait for statement execution response. Default value is 10 seconds.
      Parameters:
      duration - the maximum time to wait for statement execution response
      timeUnit - the time unit of the timeout argument
      Returns:
      updated builder instance