Search in sources :

Example 11 with HealthResult

use of io.micronaut.management.health.indicator.HealthResult in project micronaut-sql by micronaut-projects.

the class PgHealthIndicator method getResult.

@Override
public Publisher<HealthResult> getResult() {
    return client.query(QUERY).rxExecute().map(rows -> {
        HealthResult.Builder status = HealthResult.builder(NAME, HealthStatus.UP);
        Row row = rows.iterator().next();
        status.details(Collections.singletonMap("version", row.getString(0)));
        return status.build();
    }).onErrorReturn(this::buildErrorResult).toFlowable();
}
Also used : Row(io.vertx.reactivex.sqlclient.Row) HealthResult(io.micronaut.management.health.indicator.HealthResult)

Example 12 with HealthResult

use of io.micronaut.management.health.indicator.HealthResult in project micronaut-sql by micronaut-projects.

the class MySQLHealthIndicator method getResult.

@Override
public Publisher<HealthResult> getResult() {
    return client.query(QUERY).rxExecute().map(rows -> {
        HealthResult.Builder status = HealthResult.builder(NAME, HealthStatus.UP);
        Row row = rows.iterator().next();
        status.details(Collections.singletonMap("version", row.getString(0)));
        return status.build();
    }).onErrorReturn(this::buildErrorResult).toFlowable();
}
Also used : Row(io.vertx.reactivex.sqlclient.Row) HealthResult(io.micronaut.management.health.indicator.HealthResult)

Aggregations

HealthResult (io.micronaut.management.health.indicator.HealthResult)12 HealthStatus (io.micronaut.health.HealthStatus)8 Requires (io.micronaut.context.annotation.Requires)3 HealthIndicator (io.micronaut.management.health.indicator.HealthIndicator)3 Singleton (jakarta.inject.Singleton)3 Publisher (org.reactivestreams.Publisher)3 Row (io.vertx.reactivex.sqlclient.Row)2 IOException (java.io.IOException)2 Collections (java.util.Collections)2 Flux (reactor.core.publisher.Flux)2 BasicDBObject (com.mongodb.BasicDBObject)1 MongoClient (com.mongodb.reactivestreams.client.MongoClient)1 AbstractKafkaConfiguration (io.micronaut.configuration.kafka.config.AbstractKafkaConfiguration)1 KafkaDefaultConfiguration (io.micronaut.configuration.kafka.config.KafkaDefaultConfiguration)1 KafkaReactorUtil (io.micronaut.configuration.kafka.reactor.KafkaReactorUtil)1 BeanContext (io.micronaut.context.BeanContext)1 BeanRegistration (io.micronaut.context.BeanRegistration)1 AsyncSingleResultPublisher (io.micronaut.core.async.publisher.AsyncSingleResultPublisher)1 CollectionUtils (io.micronaut.core.util.CollectionUtils)1 CurrentHealthStatus (io.micronaut.health.CurrentHealthStatus)1