Search in sources :

Example 1 with DataSourcesHealthSupport

use of io.quarkus.datasource.runtime.DataSourcesHealthSupport 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());
        }
    }
}
Also used : ArcContainer(io.quarkus.arc.ArcContainer) DataSourcesHealthSupport(io.quarkus.datasource.runtime.DataSourcesHealthSupport) MSSQLPool(io.vertx.mssqlclient.MSSQLPool) PostConstruct(javax.annotation.PostConstruct)

Example 2 with DataSourcesHealthSupport

use of io.quarkus.datasource.runtime.DataSourcesHealthSupport in project quarkus by quarkusio.

the class DataSourceHealthCheck method init.

@PostConstruct
protected void init() {
    DataSourcesHealthSupport support = Arc.container().instance(DataSourcesHealthSupport.class).get();
    Set<String> names = support.getConfiguredNames();
    Set<String> excludedNames = support.getExcludedNames();
    for (String name : names) {
        DataSource ds = DataSourceUtil.isDefault(name) ? (DataSource) Arc.container().instance(DataSource.class).get() : (DataSource) Arc.container().instance(DataSource.class, new DataSourceLiteral(name)).get();
        if (!excludedNames.contains(name) && ds != null) {
            dataSources.put(name, ds);
        }
    }
}
Also used : DataSourceLiteral(io.quarkus.agroal.DataSource.DataSourceLiteral) DataSourcesHealthSupport(io.quarkus.datasource.runtime.DataSourcesHealthSupport) DataSource(javax.sql.DataSource) AgroalDataSource(io.agroal.api.AgroalDataSource) PostConstruct(javax.annotation.PostConstruct)

Example 3 with DataSourcesHealthSupport

use of io.quarkus.datasource.runtime.DataSourcesHealthSupport in project quarkus by quarkusio.

the class ReactiveOracleDataSourcesHealthCheck method init.

@PostConstruct
protected void init() {
    ArcContainer container = Arc.container();
    DataSourcesHealthSupport excluded = container.instance(DataSourcesHealthSupport.class).get();
    Set<String> excludedNames = excluded.getExcludedNames();
    for (InstanceHandle<OraclePool> handle : container.select(OraclePool.class, Any.Literal.INSTANCE).handles()) {
        String poolName = getPoolName(handle.getBean());
        if (!excludedNames.contains(poolName)) {
            addPool(poolName, handle.get());
        }
    }
}
Also used : ArcContainer(io.quarkus.arc.ArcContainer) OraclePool(io.vertx.oracleclient.OraclePool) DataSourcesHealthSupport(io.quarkus.datasource.runtime.DataSourcesHealthSupport) PostConstruct(javax.annotation.PostConstruct)

Example 4 with DataSourcesHealthSupport

use of io.quarkus.datasource.runtime.DataSourcesHealthSupport in project quarkus by quarkusio.

the class ReactivePgDataSourcesHealthCheck method init.

@PostConstruct
protected void init() {
    ArcContainer container = Arc.container();
    DataSourcesHealthSupport excluded = container.instance(DataSourcesHealthSupport.class).get();
    Set<String> excludedNames = excluded.getExcludedNames();
    for (InstanceHandle<PgPool> handle : container.select(PgPool.class, Any.Literal.INSTANCE).handles()) {
        String poolName = getPoolName(handle.getBean());
        if (!excludedNames.contains(poolName)) {
            addPool(poolName, handle.get());
        }
    }
}
Also used : ArcContainer(io.quarkus.arc.ArcContainer) DataSourcesHealthSupport(io.quarkus.datasource.runtime.DataSourcesHealthSupport) PgPool(io.vertx.pgclient.PgPool) PostConstruct(javax.annotation.PostConstruct)

Example 5 with DataSourcesHealthSupport

use of io.quarkus.datasource.runtime.DataSourcesHealthSupport in project quarkus by quarkusio.

the class ReactiveDB2DataSourcesHealthCheck method init.

@PostConstruct
protected void init() {
    ArcContainer container = Arc.container();
    DataSourcesHealthSupport excluded = container.instance(DataSourcesHealthSupport.class).get();
    Set<String> excludedNames = excluded.getExcludedNames();
    for (InstanceHandle<DB2Pool> handle : container.select(DB2Pool.class, Any.Literal.INSTANCE).handles()) {
        String db2PoolName = getDB2PoolName(handle.getBean());
        if (!excludedNames.contains(db2PoolName)) {
            db2Pools.put(db2PoolName, handle.get());
        }
    }
}
Also used : ArcContainer(io.quarkus.arc.ArcContainer) DataSourcesHealthSupport(io.quarkus.datasource.runtime.DataSourcesHealthSupport) DB2Pool(io.vertx.mutiny.db2client.DB2Pool) PostConstruct(javax.annotation.PostConstruct)

Aggregations

DataSourcesHealthSupport (io.quarkus.datasource.runtime.DataSourcesHealthSupport)6 PostConstruct (javax.annotation.PostConstruct)6 ArcContainer (io.quarkus.arc.ArcContainer)5 AgroalDataSource (io.agroal.api.AgroalDataSource)1 DataSourceLiteral (io.quarkus.agroal.DataSource.DataSourceLiteral)1 MSSQLPool (io.vertx.mssqlclient.MSSQLPool)1 DB2Pool (io.vertx.mutiny.db2client.DB2Pool)1 MySQLPool (io.vertx.mysqlclient.MySQLPool)1 OraclePool (io.vertx.oracleclient.OraclePool)1 PgPool (io.vertx.pgclient.PgPool)1 DataSource (javax.sql.DataSource)1