use of io.vertx.mssqlclient.MSSQLPool in project vertx-sql-client by eclipse-vertx.
the class MSSQLDriver method newPool.
@Override
public MSSQLPool 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 MSSQLPoolImpl(vx, closeFuture, pool);
}
use of io.vertx.mssqlclient.MSSQLPool in project vertx-sql-client by eclipse-vertx.
the class MSSQLClientExamples method configureFromDataObject.
public void configureFromDataObject(Vertx vertx) {
// Data object
MSSQLConnectOptions connectOptions = new MSSQLConnectOptions().setPort(1433).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
// Pool Options
PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
// Create the pool from the data object
MSSQLPool pool = MSSQLPool.pool(vertx, connectOptions, poolOptions);
pool.getConnection(ar -> {
// Handling your connection
});
}
use of io.vertx.mssqlclient.MSSQLPool in project vertx-sql-client by eclipse-vertx.
the class MSSQLClientExamples method connecting01.
public void connecting01() {
// Connect options
MSSQLConnectOptions connectOptions = new MSSQLConnectOptions().setPort(1433).setHost("the-host").setDatabase("the-db").setUser("user").setPassword("secret");
// Pool options
PoolOptions poolOptions = new PoolOptions().setMaxSize(5);
// Create the pooled client
MSSQLPool client = MSSQLPool.pool(connectOptions, poolOptions);
}
use of io.vertx.mssqlclient.MSSQLPool in project quarkus by quarkusio.
the class MSSQLPoolRecorder method configureMSSQLPool.
public RuntimeValue<MSSQLPool> configureMSSQLPool(RuntimeValue<Vertx> vertx, Supplier<Integer> eventLoopCount, String dataSourceName, DataSourcesRuntimeConfig dataSourcesRuntimeConfig, DataSourcesReactiveRuntimeConfig dataSourcesReactiveRuntimeConfig, DataSourcesReactiveMSSQLConfig dataSourcesReactiveMSSQLConfig, ShutdownContext shutdown) {
MSSQLPool mssqlPool = initialize(vertx.getValue(), eventLoopCount.get(), dataSourcesRuntimeConfig.getDataSourceRuntimeConfig(dataSourceName), dataSourcesReactiveRuntimeConfig.getDataSourceReactiveRuntimeConfig(dataSourceName), dataSourcesReactiveMSSQLConfig.getDataSourceReactiveRuntimeConfig(dataSourceName));
shutdown.addShutdownTask(mssqlPool::close);
return new RuntimeValue<>(mssqlPool);
}
use of io.vertx.mssqlclient.MSSQLPool in project quarkus by quarkusio.
the class ReactiveMSSQLDataSourcesHealthCheck method init.
@PostConstruct
protected void init() {
ArcContainer container = Arc.container();
DataSourcesHealthSupport excluded = container.instance(DataSourcesHealthSupport.class).get();
Set<String> excludedNames = excluded.getExcludedNames();
for (InstanceHandle<MSSQLPool> handle : container.select(MSSQLPool.class, Any.Literal.INSTANCE).handles()) {
String poolName = getPoolName(handle.getBean());
if (!excludedNames.contains(poolName)) {
addPool(poolName, handle.get());
}
}
}
Aggregations