use of io.vertx.sqlclient.SqlConnectOptions in project hibernate-reactive by hibernate.
the class TenantDependentPool method changeDbName.
/**
* Returns a new {@link SqlConnectOptions} with the correct database name for the tenant identifier.
*/
private SqlConnectOptions changeDbName(SqlConnectOptions connectOptions, Tenant tenantId) {
SqlConnectOptions newOptions = new SqlConnectOptions(connectOptions);
newOptions.setDatabase(tenantId.getDbName());
return newOptions;
}
use of io.vertx.sqlclient.SqlConnectOptions in project vertx-sql-client by eclipse-vertx.
the class MSSQLDriver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
MSSQLConnectOptions baseConnectOptions = MSSQLConnectOptions.wrap(databases.get(0));
QueryTracer tracer = vertx.tracer() == null ? null : new QueryTracer(vertx.tracer(), baseConnectOptions);
VertxMetrics vertxMetrics = vertx.metricsSPI();
ClientMetrics metrics = vertxMetrics != null ? vertxMetrics.createClientMetrics(baseConnectOptions.getSocketAddress(), "sql", baseConnectOptions.getMetricsName()) : null;
PoolImpl pool = new PoolImpl(vertx, this, tracer, metrics, 1, options, null, null, closeFuture);
List<ConnectionFactory> lst = databases.stream().map(o -> createConnectionFactory(vertx, o)).collect(Collectors.toList());
ConnectionFactory factory = ConnectionFactory.roundRobinSelector(lst);
pool.connectionProvider(factory::connect);
pool.init();
closeFuture.add(factory);
return pool;
}
use of io.vertx.sqlclient.SqlConnectOptions in project vertx-sql-client by eclipse-vertx.
the class MSSQLConnectionAutoRetryTest method initialConnector.
@Override
protected void initialConnector(int proxyPort) {
SqlConnectOptions proxyOptions = new MSSQLConnectOptions(options);
proxyOptions.setPort(proxyPort);
proxyOptions.setHost("localhost");
connectionConnector = ClientConfig.CONNECT.connect(vertx, proxyOptions);
poolConnector = ClientConfig.POOLED.connect(vertx, proxyOptions);
}
use of io.vertx.sqlclient.SqlConnectOptions in project vertx-sql-client by eclipse-vertx.
the class PgDriver method newPoolImpl.
private PoolImpl newPoolImpl(VertxInternal vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
PgConnectOptions baseConnectOptions = PgConnectOptions.wrap(databases.get(0));
QueryTracer tracer = vertx.tracer() == null ? null : new QueryTracer(vertx.tracer(), baseConnectOptions);
VertxMetrics vertxMetrics = vertx.metricsSPI();
ClientMetrics metrics = vertxMetrics != null ? vertxMetrics.createClientMetrics(baseConnectOptions.getSocketAddress(), "sql", baseConnectOptions.getMetricsName()) : null;
boolean pipelinedPool = options instanceof PgPoolOptions && ((PgPoolOptions) options).isPipelined();
int pipeliningLimit = pipelinedPool ? baseConnectOptions.getPipeliningLimit() : 1;
PoolImpl pool = new PoolImpl(vertx, this, tracer, metrics, pipeliningLimit, options, null, null, closeFuture);
List<ConnectionFactory> lst = databases.stream().map(o -> createConnectionFactory(vertx, o)).collect(Collectors.toList());
ConnectionFactory factory = ConnectionFactory.roundRobinSelector(lst);
pool.connectionProvider(factory::connect);
pool.init();
closeFuture.add(factory);
return pool;
}
use of io.vertx.sqlclient.SqlConnectOptions in project vertx-sql-client by eclipse-vertx.
the class PgDriver method newPool.
@Override
public PgPool newPool(Vertx vertx, List<? extends SqlConnectOptions> databases, PoolOptions options, CloseFuture closeFuture) {
VertxInternal vx = (VertxInternal) vertx;
PoolImpl pool;
if (options.isShared()) {
pool = vx.createSharedClient(SHARED_CLIENT_KEY, options.getName(), closeFuture, cf -> newPoolImpl(vx, databases, options, cf));
} else {
pool = newPoolImpl(vx, databases, options, closeFuture);
}
return new PgPoolImpl(vx, closeFuture, pool);
}
Aggregations