commit
5ad4de184d
|
|
@ -15,6 +15,7 @@
|
|||
*/
|
||||
package org.springframework.boot.actuate.cassandra;
|
||||
|
||||
import com.datastax.oss.driver.api.core.ConsistencyLevel;
|
||||
import com.datastax.oss.driver.api.core.cql.SimpleStatement;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
|
|
@ -32,6 +33,9 @@ import org.springframework.util.Assert;
|
|||
*/
|
||||
public class CassandraReactiveHealthIndicator extends AbstractReactiveHealthIndicator {
|
||||
|
||||
private static final SimpleStatement SELECT = SimpleStatement
|
||||
.newInstance("SELECT release_version FROM system.local").setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);
|
||||
|
||||
private final ReactiveCassandraOperations reactiveCassandraOperations;
|
||||
|
||||
/**
|
||||
|
|
@ -46,8 +50,7 @@ public class CassandraReactiveHealthIndicator extends AbstractReactiveHealthIndi
|
|||
|
||||
@Override
|
||||
protected Mono<Health> doHealthCheck(Health.Builder builder) {
|
||||
SimpleStatement select = SimpleStatement.newInstance("SELECT release_version FROM system.local");
|
||||
return this.reactiveCassandraOperations.getReactiveCqlOperations().queryForObject(select, String.class)
|
||||
return this.reactiveCassandraOperations.getReactiveCqlOperations().queryForObject(SELECT, String.class)
|
||||
.map((version) -> builder.up().withDetail("version", version).build()).single();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue