Description
Hello,
I'm trying to implement a way of moving data from one Couchbase cluster to another with a strategy that involves only moving the data when it is accessed (through external user interaction). To do this, I would need to be able to connect to two different Couchbase clusters and be able to map the same Documents to their target cluster + bucket combination. I've seen how we can configure for multiple buckets inside the same cluster here: https://github.com/spring-projects/spring-data-couchbase/blob/main/src/test/java/org/springframework/data/couchbase/domain/Config.java#L136 .
I think changing to a bucket in a different cluster shouldn't be that difficult by providing a connectionString to myCouchbaseClientFactory instead of using the same one for all buckets, but the problem is that the mapping is done by entity type to a CouchbaseTemplate, meaning that the same entity cannot be mapped to two different templates.
I managed to do this in this sample repository: https://github.com/zandrei/couchbase-multiple-clusters .
I've also added a Readme where I highlighted how it can be started and run and what were the issues and impediments. The question would be if there is a better way of achieving this goal, without re-implementing a lot of the framework glue.
Libraries and versions:
spring-data-couchbase 5.1.4
com.couchbase.client:java-client: 3.4.10
Couchbase server: community 6.6.0