Can I set the default Stale behavior in the Java SDK?

By default, the Java SDK sets the stale parameter to UPDATE_AFTER. I need all view queries in my application to run with the FALSE parameter.

Instead of manually configuring each query, is there a way to tell the Java SDK to use FALSE by default ?

If not, would it be possible on the server ?

Hi, it’s not possible to setup a default behavior with the SDK. It’s possible when using a wrapper like Spring Data Couchbase.
It’s not possible either on the server.

Hey, thank you for the answer ! We are using Spring Data Couchbase but I haven’t found a way to override the default stale. How can I do that ?

Which version are you using?

We’re using version 1.3.2.RELEASE of spring-data-couchbase

So, it’s only available in the 2.x branch (that has not been released yet), sorry I am mixing things up.
You would probably have to extend the default Couchbase template. @simonbasle might be able to help here.

as @ldoguin said, this is a feature that has been added in the 2.0.x branch, currently in development.
with 1.4.x, there is no standard mechanism in place to do that…

If you are still planning ahead, maybe you can code a Factory for ViewQuery that will centralize the Stale parameter (and make it configurable somehow)?

If you already have a lot of view queries in your code and you now want to have them all share the same Stale tuning, then you’ll have to refactor your code anyway.