use of com.couchbase.client.java.kv.ReplicateTo in project kafka-connect-couchbase by couchbase.
the class DurabilitySetter method create.
static DurabilitySetter create(DurabilityConfig config) {
DurabilityLevel durabilityLevel = config.durability();
if (durabilityLevel != DurabilityLevel.NONE) {
if (config.persistTo() != PersistTo.NONE || config.replicateTo() != ReplicateTo.NONE) {
String durabilityKey = keyName(DurabilityConfig.class, DurabilityConfig::durability);
String replicateToKey = keyName(DurabilityConfig.class, DurabilityConfig::replicateTo);
String persistToKey = keyName(DurabilityConfig.class, DurabilityConfig::persistTo);
throw new ConnectException("Invalid durability config. When '" + durabilityKey + "' is set," + " you must not set '" + replicateToKey + "' or '" + persistToKey + "'.");
}
return options -> options.durability(durabilityLevel);
}
PersistTo persistTo = config.persistTo();
ReplicateTo replicateTo = config.replicateTo();
return options -> options.durability(persistTo, replicateTo);
}
Aggregations