I am creating web services which exposes data to Kishanda from a special interface. In addition, using spring-boot-web for the REST service part, and spring-boot actuator for production-ready facilities, looking for a custom health indicator () for Spring-Data-Cassandra I CassandraTemplate for the Casanda interface I'm the one I can plug in.
I have not found any of the spring-data-casandra documentation. Do we have any development?
In more general terms, what would be a good strategy to examine the health of the cassandra template? Neither spring boot and spring data provide a health indicator for the casandra outside of the casandra box,
But it is easy to make your own straight. You just need to create a new Health Indicator Bean that contacts Kassandra for example:
import org.springframework.beans.factory .annotation.Autowired; Import org.springframework.boot.actuate.health.AbstractHealthIndicator; Import organization Import org.springframework.dao.DataAccessException; Import org.springframework.data.cassandra.core.CassandraOperations; Import org.springframework.stereotype.Component; @Component Public Class CassandraHealthIndicator offers IntuitHighth Indicator {Personal Finals CassandraOperations cassandra; @ Swadhin Public Cassandra Health Indicator (Cassandra Operation Cassandra) {this.cassandra = cassandra; } @ Override protected zero-devious checker (builder builder) throws exception {try {this.cassandra.execute ("select now (from system.local"); Builder.up () build () .; } Hold (DataAccessException pre) {builder.down (ex) .build (); }}}
Until this Bean is present in your application context, the Spring Boot Actuctor components will be able to obtain it and use it when determining the health of your application. .
Exactly what query you executed against Cassandra may vary depending on your needs. The above questions were taken from a question about health checkups on Cassandra.
Comments
Post a Comment