I am trying to customize the timeout settings for my couchbase Spring Boot client. I am using spring-boot-starter-data-couchbase
in my project. Specifically what I want to do is, when it's taking too long for the couchbase to respond(may be say because of some network partition or any other reason). I just want to send some default response to my client. I followed this answer and am also using AbstractCouchbaseConfiguration
to configure the timeout but it is just not working.
Below is the overridden method from my configuration class.
@Override
protected CouchbaseEnvironment getEnvironment() {
DefaultCouchbaseEnvironment.builder()
.connectTimeout(TimeUnit.SECONDS.toMillis(2))
.maxRequestLifetime(TimeUnit.SECONDS.toMillis(2))
.socketConnectTimeout(1000).queryTimeout(TimeUnit.SECONDS.toMillis(2));
return super.getEnvironment();
}
Can someone please help me with this?