public interface ClientBuilder<C>
SqlClient
instances.Modifier and Type | Method and Description |
---|---|
C |
build()
Build and return the client.
|
ClientBuilder<C> |
connectingTo(List<SqlConnectOptions> databases)
Configure the
database the client should connect to. |
ClientBuilder<C> |
connectingTo(SqlConnectOptions database)
Configure the
database the client should connect to. |
ClientBuilder<C> |
connectingTo(String database)
Configure the
database the client should connect to. |
ClientBuilder<C> |
connectingTo(java.util.function.Supplier<Future<SqlConnectOptions>> supplier)
Configure the
database the client should connect to. |
static ClientBuilder<Pool> |
pool(Driver driver)
Provide a builder for a pool of connections for the specified
Driver |
static Pool |
pool(Driver driver,
Handler<ClientBuilder<Pool>> block)
Build a pool with the specified
block argument and Driver
The block argument is usually a lambda that configures the provided builder |
ClientBuilder<C> |
using(Vertx vertx)
Sets the vertx instance to use.
|
ClientBuilder<C> |
with(PoolOptions options)
Configure the client with the given pool
options |
ClientBuilder<C> |
withConnectHandler(Handler<SqlConnection> handler)
Set a handler called when the pool has established a connection to the database.
|
static ClientBuilder<Pool> pool(Driver driver)
Driver
Example usage: Pool pool = ClientBuilder.pool(driver).connectingTo(connectOptions).build()
static Pool pool(Driver driver, Handler<ClientBuilder<Pool>> block)
block
argument and Driver
The block
argument is usually a lambda that configures the provided builder
Example usage: Pool pool = ClientBuilder.pool(driver, builder -> builder.connectingTo(connectOptions));
block
ClientBuilder<C> with(PoolOptions options)
options
options
- the pool optionsClientBuilder<C> connectingTo(SqlConnectOptions database)
database
the client should connect to. The target database
is specified as
a SqlConnectOptions
coordinates.database
- the database coordinatesClientBuilder<C> connectingTo(String database)
database
the client should connect to. The target database
is specified as
a SqlConnectOptions
coordinates.database
- the database URIClientBuilder<C> connectingTo(java.util.function.Supplier<Future<SqlConnectOptions>> supplier)
database
the client should connect to. When the client needs to connect to the database,
it gets fresh database configuration from the database supplier
.supplier
- the supplier of database coordinatesClientBuilder<C> connectingTo(List<SqlConnectOptions> databases)
database
the client should connect to. When the client needs to connect to the database,
it gets a database configuration from the list of databases
using a round-robin policy.databases
- the list of database coordinatesClientBuilder<C> using(Vertx vertx)
vertx
- the vertx instanceClientBuilder<C> withConnectHandler(Handler<SqlConnection> handler)
This handler allows interactions with the database before the connection is added to the pool.
When the handler has finished, it must call SqlClient.close()
to release the connection
to the pool.
handler
- the handlerC build()
Copyright © 2024 Eclipse. All rights reserved.