Module io.helidon.dbclient.health
Package io.helidon.dbclient.health
Class DbClientHealthCheck.Builder
- java.lang.Object
-
- io.helidon.dbclient.health.DbClientHealthCheck.Builder
-
- All Implemented Interfaces:
Builder<DbClientHealthCheck>
,Supplier<DbClientHealthCheck>
- Enclosing class:
- DbClientHealthCheck
public static final class DbClientHealthCheck.Builder extends Object implements Builder<DbClientHealthCheck>
Fluent API builder forDbClientHealthCheck
. Default health check setup will call named DML statement with nameping
. This named DML statement shall be configured instatements
section of the DBClient configuration file.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DbClientHealthCheck
build()
Build the instance from this builder.DbClientHealthCheck.Builder
config(Config config)
Set health check parameters usingConfig
node.DbClientHealthCheck.Builder
dml()
Set health check statement type to DML.DbClientHealthCheck.Builder
name(String name)
Customized name of the health check.DbClientHealthCheck.Builder
query()
Set health check statement type to query.DbClientHealthCheck.Builder
statement(String statement)
Set custom statement.DbClientHealthCheck.Builder
statementName(String name)
Set custom statement name.DbClientHealthCheck.Builder
timeout(long duration, TimeUnit timeUnit)
Set custom timeout to wait for statement execution response.
-
-
-
Method Detail
-
build
public DbClientHealthCheck build()
Description copied from interface:Builder
Build the instance from this builder.- Specified by:
build
in interfaceBuilder<DbClientHealthCheck>
- Returns:
- instance of the built type
-
name
public DbClientHealthCheck.Builder name(String name)
Customized name of the health check. Default usesDbClient.dbType()
.- Parameters:
name
- name of the health check- Returns:
- updated builder instance
-
config
public DbClientHealthCheck.Builder config(Config config)
Set health check parameters usingConfig
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
).
- Parameters:
config
-Config
instance with health check parameters- Returns:
- updated builder instance
-
query
public DbClientHealthCheck.Builder query()
Set health check statement type to query. Allows to override value set inConfig
node. Default health check statement type is query.- Returns:
- updated builder instance
-
dml
public DbClientHealthCheck.Builder dml()
Set health check statement type to DML. Allows to override value set inConfig
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 isping
.- 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 is10
seconds.- Parameters:
duration
- the maximum time to wait for statement execution responsetimeUnit
- the time unit of the timeout argument- Returns:
- updated builder instance
-
-