use of io.vertx.mutiny.db2client.DB2Pool in project quarkus by quarkusio.
the class ReactiveDB2DataSourcesHealthCheck method call.
@Override
public HealthCheckResponse call() {
HealthCheckResponseBuilder builder = HealthCheckResponse.named("Reactive DB2 connections health check");
builder.up();
for (Entry<String, DB2Pool> db2PoolEntry : db2Pools.entrySet()) {
String dataSourceName = db2PoolEntry.getKey();
DB2Pool db2Pool = db2PoolEntry.getValue();
try {
db2Pool.query("SELECT 1 FROM SYSIBM.SYSDUMMY1").execute().await().atMost(Duration.ofSeconds(10));
builder.withData(dataSourceName, "up");
} catch (Exception exception) {
builder.down();
builder.withData(dataSourceName, "down - connection failed: " + exception.getMessage());
}
}
return builder.build();
}
use of io.vertx.mutiny.db2client.DB2Pool 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());
}
}
}
Aggregations