I am trying to speed up our code by calling session.executeAsync() instead of session.execute() to write a DB.
We have cases when the connection to the database may not be available, currently the previous execute() throws an exception when the connection is lost (there are not enough hosts in the cluster). We can catch these exceptions and try again or save the data in another place, etc.
With executeAsync() , it doesn't seem like any way to fulfill this use case is that you need to access the object of the returned ResultSetFuture object to check the result, which will lead to the defeat of the goal of using executeAsync() in the first place ...
Is there a way to add a listener (or something similar) anywhere in the call to executeAsync (), which will asynchronously notify any other code that failed to write to the database failed?
Is this appropriate? Datastax 1.0.2 Java 1.7.40
java datastax-java-driver datastax
Phillip atkinson
source share