spring-data-couchbase icon indicating copy to clipboard operation
spring-data-couchbase copied to clipboard

Support configuring default DurabilityLevel, PersistTo, ReplicateTo values

Open aaronjwhiteside opened this issue 5 years ago • 4 comments

In our organization it's rare that we require specific durability per document, typically it's the same across all our documents and even projects.

It would be nice if we could drive this by a configuration property in application.properties, though I expect Spring Boot to actually contain that logic via CouchbaseDataProperties, but it would be nice if Spring Data Couchbase exposed a way to supply these values.

aaronjwhiteside avatar Jan 21 '21 03:01 aaronjwhiteside

Building on this, there is also no current way to specify the durability for a Repository#save call.

To reinforce the configurability requirement above, when testing locally developers typically have a single node cluster, but when deploying in production you want to ensure that data hits more than a single node. This may preclude using an annotation on the Repository level. Unless it reads configuration via a SpEL expression.

aaronjwhiteside avatar Feb 04 '21 23:02 aaronjwhiteside

Starting in spring-data-couchbase-4.3.0-M2 repository.withOptions(Upsert/ReplaceOptions).save(...) will be supported. Similarily for template : couchbaseTemplate.findById(Airport.class).withOptions(getOptions).one(id);

Should be here by the end of the week:

https://repo.spring.io/artifactory/libs-milestone-local/org/springframework/data/spring-data-couchbase/4.3.0-M2/spring-data-couchbase-4.3.0-M2.jar

https://repo.spring.io/ui/repos/tree/General/libs-milestone

mikereiche avatar Aug 11 '21 22:08 mikereiche

Annotations could be added in the future (similar to ScanConsistency) - on methods, repository and entity.

mikereiche avatar Aug 11 '21 23:08 mikereiche

Durability annotation to be added in the same places as ScanConsistency.

mikereiche avatar Aug 14 '21 02:08 mikereiche