0

I'd like to add a database connection health check to my Dropwizard project but I'm not sure how to test if the database connection is valid with astyanax.

I have two ideas:

  1. There's a keyspace.connected() function that I haven't been able to find
  2. Create my own connected() function that attempts to send a query to test the connection and catches any connection exceptions.
  • I've made a quick check about [astyanax](https://github.com/Netflix/astyanax). The most suitable thing to do (IMO) is to query the information schema for the keyspace you are interested in (see [this question](http://stackoverflow.com/questions/18712967/how-to-list-all-the-available-keyspaces-in-cassandra)) - you will know if you can access the cluster and if the cluster knows about the keyspace you are interested in. – zloster Nov 07 '14 at 13:16
  • Also you can add/implement custom [ConnectionPoolMonitor](https://github.com/Netflix/astyanax/blob/master/astyanax-core/src/main/java/com/netflix/astyanax/connectionpool/ConnectionPoolMonitor.java) that could be integrated with the Metrics library used by Dropwizard. So you will have the internal connection pool stats directly together with the other stats on the default page. – zloster Nov 07 '14 at 13:30
  • Have you checked my comments? – zloster Nov 15 '14 at 09:36

0 Answers0