10

Using a combination of Spring Boot 1.4.1.Release and Spring Data Couchbase 2.1.3.RELEASE, is there a way to prevent application startup failure if it cannot connect to couchbase?

Current behavior: Application cannot connect to couchbase on startup and exits.

The goal: Application would continue to start even though it cannot connect to Couchbase, use the timeout configurations in CouchbaseEnvironment, and continually try to connect in the background.

In Spring Boot, we can configure Spring JDBC to ignore failure on startup with spring.datasource.continue-on-error=true. Any chance something like that coupled with a retry on failure exists in Spring Data Couchbase?

mengchengfeng
  • 298
  • 1
  • 9

1 Answers1

1

You can configure CouchbaseEnvironment by overriding getCouchbaseEnvironment using JavaConfig and try increasing the connect timeout. Is there a specific connection failure you are running into?

There isn't continue-on-error property for spring-data-couchbase. This property is available on Spring Boot for relational JDBC and it is useful to ignore initialize failures such as failing to create tables and loading into data sources using scripts.

subhashni
  • 216
  • 1
  • 6
  • 1
    I've tried configuring CouchbaseEnvironment but I don't want to extend the connection timeout error - I want it to ignore connection errors altogether. It doesn't matter so much the type of exception I'm experiencing when attempting to connect to Couchbase. I just want the application to start up successfully, then continue to retry connecting every X seconds. – mengchengfeng Nov 22 '16 at 18:40
  • 1
    @mengchengfeng , any news? did you succeed? – T.S Dec 23 '18 at 15:47