This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 87499e2  CAMEL-17108: add resume strategy support for CouchDB
87499e2 is described below

commit 87499e2208de23dacbbe4b6ea0a1b6a3cd552384
Author: Otavio Rodolfo Piske <[email protected]>
AuthorDate: Mon Oct 25 12:52:40 2021 +0200

    CAMEL-17108: add resume strategy support for CouchDB
---
 .../apache/camel/catalog/components/couchdb.json   |  2 +-
 .../couchdb/CouchDbEndpointConfigurer.java         |  9 ++--
 .../couchdb/CouchDbEndpointUriFactory.java         |  2 +-
 .../apache/camel/component/couchdb/couchdb.json    |  2 +-
 .../src/main/docs/couchdb-component.adoc           | 11 +++++
 .../component/couchdb/CouchDbChangesetTracker.java | 17 +++++--
 .../camel/component/couchdb/CouchDbEndpoint.java   | 15 +++---
 .../couchdb/consumer/CouchDbResumable.java         | 53 ++++++++++++++++++++++
 .../couchdb/consumer/CouchDbResumeStrategy.java    | 27 +++++++++++
 .../consumer/CouchDdResumeStrategyFactory.java     | 35 ++++++++++++++
 .../LatestUpdateSequenceResumeStrategy.java        | 33 ++++++++++++++
 .../dsl/CouchDbEndpointBuilderFactory.java         | 33 +++++++++++---
 .../ROOT/pages/camel-3x-upgrade-guide-3_13.adoc    |  4 ++
 13 files changed, 219 insertions(+), 24 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json
index 2c26fbf..c68bc3a 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/couchdb.json
@@ -35,7 +35,7 @@
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Allows for bridging the 
consumer to the Camel routing Error Handler, which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages, or the likes, will 
now be processed as a m [...]
     "deletes": { "kind": "parameter", "displayName": "Deletes", "group": 
"consumer", "label": "consumer", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": true, "description": "Document deletes are published as 
events" },
     "heartbeat": { "kind": "parameter", "displayName": "Heartbeat", "group": 
"consumer", "label": "consumer", "required": false, "type": "duration", 
"javaType": "long", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "30000", "description": "How often to send an empty message to 
keep socket alive in millis" },
-    "since": { "kind": "parameter", "displayName": "Since", "group": 
"consumer", "label": "consumer", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Start tracking changes immediately after the 
given update sequence. The default, null, will start monitoring from the latest 
sequence." },
+    "resumeStrategy": { "kind": "parameter", "displayName": "Resume Strategy", 
"group": "consumer", "label": "consumer", "required": false, "type": "object", 
"javaType": 
"org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
a custom resume strategy for tracking changes from CouchDB. It allows tracking 
from a specific point (i.e.: since the given update sequence, the latest 
sequence, etc)." },
     "style": { "kind": "parameter", "displayName": "Style", "group": 
"consumer", "label": "consumer", "required": false, "type": "string", 
"javaType": "java.lang.String", "enum": [ "all_docs", "main_only" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"main_only", "description": "Specifies how many revisions are returned in the 
changes array. The default, main_only, will only return the current winning 
revision; all_docs will return all leaf revisions (inclu [...]
     "updates": { "kind": "parameter", "displayName": "Updates", "group": 
"consumer", "label": "consumer", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": true, "description": "Document inserts\/updates are 
published as events" },
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception 
Handler", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By default the 
con [...]
diff --git 
a/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointConfigurer.java
 
b/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointConfigurer.java
index 627a4cb..5452c62 100644
--- 
a/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointConfigurer.java
+++ 
b/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointConfigurer.java
@@ -34,7 +34,8 @@ public class CouchDbEndpointConfigurer extends 
PropertyConfigurerSupport impleme
         case "lazystartproducer":
         case "lazyStartProducer": 
target.setLazyStartProducer(property(camelContext, boolean.class, value)); 
return true;
         case "password": target.setPassword(property(camelContext, 
java.lang.String.class, value)); return true;
-        case "since": target.setSince(property(camelContext, 
java.lang.String.class, value)); return true;
+        case "resumestrategy":
+        case "resumeStrategy": target.setResumeStrategy(property(camelContext, 
org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy.class, 
value)); return true;
         case "style": target.setStyle(property(camelContext, 
java.lang.String.class, value)); return true;
         case "updates": target.setUpdates(property(camelContext, 
boolean.class, value)); return true;
         case "username": target.setUsername(property(camelContext, 
java.lang.String.class, value)); return true;
@@ -58,7 +59,8 @@ public class CouchDbEndpointConfigurer extends 
PropertyConfigurerSupport impleme
         case "lazystartproducer":
         case "lazyStartProducer": return boolean.class;
         case "password": return java.lang.String.class;
-        case "since": return java.lang.String.class;
+        case "resumestrategy":
+        case "resumeStrategy": return 
org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy.class;
         case "style": return java.lang.String.class;
         case "updates": return boolean.class;
         case "username": return java.lang.String.class;
@@ -83,7 +85,8 @@ public class CouchDbEndpointConfigurer extends 
PropertyConfigurerSupport impleme
         case "lazystartproducer":
         case "lazyStartProducer": return target.isLazyStartProducer();
         case "password": return target.getPassword();
-        case "since": return target.getSince();
+        case "resumestrategy":
+        case "resumeStrategy": return target.getResumeStrategy();
         case "style": return target.getStyle();
         case "updates": return target.isUpdates();
         case "username": return target.getUsername();
diff --git 
a/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointUriFactory.java
 
b/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointUriFactory.java
index 98e6549..914c93e 100644
--- 
a/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointUriFactory.java
+++ 
b/components/camel-couchdb/src/generated/java/org/apache/camel/component/couchdb/CouchDbEndpointUriFactory.java
@@ -33,9 +33,9 @@ public class CouchDbEndpointUriFactory extends 
org.apache.camel.support.componen
         props.add("password");
         props.add("bridgeErrorHandler");
         props.add("port");
+        props.add("resumeStrategy");
         props.add("style");
         props.add("exceptionHandler");
-        props.add("since");
         props.add("username");
         PROPERTY_NAMES = Collections.unmodifiableSet(props);
         Set<String> secretProps = new HashSet<>(2);
diff --git 
a/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json
 
b/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json
index 2c26fbf..c68bc3a 100644
--- 
a/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json
+++ 
b/components/camel-couchdb/src/generated/resources/org/apache/camel/component/couchdb/couchdb.json
@@ -35,7 +35,7 @@
     "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error 
Handler", "group": "consumer", "label": "consumer", "required": false, "type": 
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": false, "description": "Allows for bridging the 
consumer to the Camel routing Error Handler, which mean any exceptions occurred 
while the consumer is trying to pickup incoming messages, or the likes, will 
now be processed as a m [...]
     "deletes": { "kind": "parameter", "displayName": "Deletes", "group": 
"consumer", "label": "consumer", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": true, "description": "Document deletes are published as 
events" },
     "heartbeat": { "kind": "parameter", "displayName": "Heartbeat", "group": 
"consumer", "label": "consumer", "required": false, "type": "duration", 
"javaType": "long", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "30000", "description": "How often to send an empty message to 
keep socket alive in millis" },
-    "since": { "kind": "parameter", "displayName": "Since", "group": 
"consumer", "label": "consumer", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "Start tracking changes immediately after the 
given update sequence. The default, null, will start monitoring from the latest 
sequence." },
+    "resumeStrategy": { "kind": "parameter", "displayName": "Resume Strategy", 
"group": "consumer", "label": "consumer", "required": false, "type": "object", 
"javaType": 
"org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy", 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
a custom resume strategy for tracking changes from CouchDB. It allows tracking 
from a specific point (i.e.: since the given update sequence, the latest 
sequence, etc)." },
     "style": { "kind": "parameter", "displayName": "Style", "group": 
"consumer", "label": "consumer", "required": false, "type": "string", 
"javaType": "java.lang.String", "enum": [ "all_docs", "main_only" ], 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": 
"main_only", "description": "Specifies how many revisions are returned in the 
changes array. The default, main_only, will only return the current winning 
revision; all_docs will return all leaf revisions (inclu [...]
     "updates": { "kind": "parameter", "displayName": "Updates", "group": 
"consumer", "label": "consumer", "required": false, "type": "boolean", 
"javaType": "boolean", "deprecated": false, "autowired": false, "secret": 
false, "defaultValue": true, "description": "Document inserts\/updates are 
published as events" },
     "exceptionHandler": { "kind": "parameter", "displayName": "Exception 
Handler", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By default the 
con [...]
diff --git a/components/camel-couchdb/src/main/docs/couchdb-component.adoc 
b/components/camel-couchdb/src/main/docs/couchdb-component.adoc
index 5f4ac14..9a1a56d 100644
--- a/components/camel-couchdb/src/main/docs/couchdb-component.adoc
+++ b/components/camel-couchdb/src/main/docs/couchdb-component.adoc
@@ -130,5 +130,16 @@ exchange is used
 
from("someProducingEndpoint").process(someProcessor).to("couchdb:http://localhost:9999";)
 
----------------------------------------------------------------------------------------
 
+To start tracking the changes immediately after an update sequence, implement 
a custom resume strategy. To do so, it is necessary to implement a 
CouchDbResumeStrategy and use the resumable to set the last (update) offset to 
start tracking the changes:
+
+```
+public class CustomSequenceResumeStrategy implements CouchDbResumeStrategy {
+    @Override
+    public void resume(CouchDbResumable resumable) {
+        resumable.setLastOffset("custom-last-update");
+    }
+}
+```
+
 
 include::spring-boot:partial$starter.adoc[]
diff --git 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbChangesetTracker.java
 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbChangesetTracker.java
index ab110d1..781b4fa 100644
--- 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbChangesetTracker.java
+++ 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbChangesetTracker.java
@@ -18,6 +18,9 @@ package org.apache.camel.component.couchdb;
 
 import com.google.gson.JsonObject;
 import org.apache.camel.Exchange;
+import org.apache.camel.component.couchdb.consumer.CouchDbResumable;
+import org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy;
+import 
org.apache.camel.component.couchdb.consumer.CouchDdResumeStrategyFactory;
 import org.lightcouch.Changes;
 import org.lightcouch.ChangesResult;
 import org.lightcouch.CouchDbException;
@@ -42,13 +45,17 @@ public class CouchDbChangesetTracker implements Runnable {
     }
 
     private void initChanges(final String sequence) {
-        String since = sequence;
-        if (null == since) {
-            since = couchClient.getLatestUpdateSequence();
+        CouchDbResumable resumable = new CouchDbResumable(couchClient, 
sequence);
+
+        if (sequence == null) {
+            CouchDbResumeStrategy resumeStrategy = 
CouchDdResumeStrategyFactory.newResumeStrategy(this.endpoint);
+
+            resumeStrategy.resume(resumable);
         }
-        LOG.debug("Last sequence [{}]", since);
+
+        LOG.debug("Last sequence [{}]", resumable.getLastOffset());
         changes = 
couchClient.changes().style(endpoint.getStyle()).includeDocs(true)
-                
.since(since).heartBeat(endpoint.getHeartbeat()).continuousChanges();
+                
.since(resumable.getLastOffset()).heartBeat(endpoint.getHeartbeat()).continuousChanges();
     }
 
     @Override
diff --git 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java
 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java
index e9c6078..b2db700 100644
--- 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java
+++ 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java
@@ -22,6 +22,7 @@ import org.apache.camel.Category;
 import org.apache.camel.Consumer;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy;
 import org.apache.camel.spi.Metadata;
 import org.apache.camel.spi.UriEndpoint;
 import org.apache.camel.spi.UriParam;
@@ -70,7 +71,7 @@ public class CouchDbEndpoint extends DefaultEndpoint {
     @UriParam(label = "consumer", defaultValue = "true")
     private boolean updates = true;
     @UriParam(label = "consumer")
-    private String since;
+    private CouchDbResumeStrategy resumeStrategy;
 
     public CouchDbEndpoint() {
     }
@@ -238,15 +239,15 @@ public class CouchDbEndpoint extends DefaultEndpoint {
         this.updates = updates;
     }
 
-    public String getSince() {
-        return since;
+    public CouchDbResumeStrategy getResumeStrategy() {
+        return resumeStrategy;
     }
 
     /**
-     * Start tracking changes immediately after the given update sequence. The 
default, null, will start monitoring from
-     * the latest sequence.
+     * Sets a custom resume strategy for tracking changes from CouchDB. It 
allows tracking from a specific point (i.e.:
+     * since the given update sequence, the latest sequence, etc).
      */
-    public void setSince(String since) {
-        this.since = since;
+    public void setResumeStrategy(CouchDbResumeStrategy resumeStrategy) {
+        this.resumeStrategy = resumeStrategy;
     }
 }
diff --git 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDbResumable.java
 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDbResumable.java
new file mode 100644
index 0000000..ac3d679
--- /dev/null
+++ 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDbResumable.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.couchdb.consumer;
+
+import org.apache.camel.Resumable;
+import org.apache.camel.component.couchdb.CouchDbClientWrapper;
+
+/**
+ * Wraps the resume data for CouchDb
+ */
+public class CouchDbResumable implements Resumable<String> {
+    private final CouchDbClientWrapper clientWrapper;
+    private String offset;
+
+    public CouchDbResumable(CouchDbClientWrapper clientWrapper, String offset) 
{
+        this.clientWrapper = clientWrapper;
+        this.offset = offset;
+    }
+
+    @Override
+    public void setLastOffset(String offset) {
+        this.offset = offset;
+    }
+
+    @Override
+    public String getLastOffset() {
+        return offset;
+    }
+
+    /**
+     * Gets the client wrapper. Fine for local access, but should be 
restricted for global access on the API
+     * 
+     * @return the client wrapper
+     */
+    CouchDbClientWrapper getClientWrapper() {
+        return clientWrapper;
+    }
+}
diff --git 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDbResumeStrategy.java
 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDbResumeStrategy.java
new file mode 100644
index 0000000..cd8ba08
--- /dev/null
+++ 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDbResumeStrategy.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.couchdb.consumer;
+
+import org.apache.camel.ResumeStrategy;
+
+/**
+ * Defines a resumable strategy usable by the CouchDB component
+ */
+public interface CouchDbResumeStrategy extends 
ResumeStrategy<CouchDbResumable> {
+
+}
diff --git 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDdResumeStrategyFactory.java
 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDdResumeStrategyFactory.java
new file mode 100644
index 0000000..15d4543
--- /dev/null
+++ 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/CouchDdResumeStrategyFactory.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.couchdb.consumer;
+
+import org.apache.camel.component.couchdb.CouchDbEndpoint;
+
+public final class CouchDdResumeStrategyFactory {
+    private CouchDdResumeStrategyFactory() {
+    }
+
+    public static CouchDbResumeStrategy newResumeStrategy(CouchDbEndpoint 
endpoint) {
+        CouchDbResumeStrategy resumeStrategy = endpoint.getResumeStrategy();
+
+        if (resumeStrategy == null) {
+            resumeStrategy = new LatestUpdateSequenceResumeStrategy();
+        }
+
+        return resumeStrategy;
+    }
+}
diff --git 
a/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/LatestUpdateSequenceResumeStrategy.java
 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/LatestUpdateSequenceResumeStrategy.java
new file mode 100644
index 0000000..ac80db8
--- /dev/null
+++ 
b/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/consumer/LatestUpdateSequenceResumeStrategy.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.camel.component.couchdb.consumer;
+
+import org.apache.camel.component.couchdb.CouchDbClientWrapper;
+
+/**
+ * A resume strategy that resumes from the last update sequence
+ */
+public final class LatestUpdateSequenceResumeStrategy implements 
CouchDbResumeStrategy {
+
+    @Override
+    public void resume(CouchDbResumable resumable) {
+        CouchDbClientWrapper clientWrapper = resumable.getClientWrapper();
+
+        resumable.setLastOffset(clientWrapper.getLatestUpdateSequence());
+    }
+}
diff --git 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java
index 7fba6aa..d658b8d 100644
--- 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchDbEndpointBuilderFactory.java
@@ -182,18 +182,39 @@ public interface CouchDbEndpointBuilderFactory {
             return this;
         }
         /**
-         * Start tracking changes immediately after the given update sequence.
-         * The default, null, will start monitoring from the latest sequence.
+         * Sets a custom resume strategy for tracking changes from CouchDB. It
+         * allows tracking from a specific point (i.e.: since the given update
+         * sequence, the latest sequence, etc).
          * 
-         * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
+         * The option is a:
+         * 
&lt;code&gt;org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy&lt;/code&gt;
 type.
+         * 
+         * Group: consumer
+         * 
+         * @param resumeStrategy the value to set
+         * @return the dsl builder
+         */
+        default CouchDbEndpointConsumerBuilder resumeStrategy(
+                Object resumeStrategy) {
+            doSetProperty("resumeStrategy", resumeStrategy);
+            return this;
+        }
+        /**
+         * Sets a custom resume strategy for tracking changes from CouchDB. It
+         * allows tracking from a specific point (i.e.: since the given update
+         * sequence, the latest sequence, etc).
+         * 
+         * The option will be converted to a
+         * 
&lt;code&gt;org.apache.camel.component.couchdb.consumer.CouchDbResumeStrategy&lt;/code&gt;
 type.
          * 
          * Group: consumer
          * 
-         * @param since the value to set
+         * @param resumeStrategy the value to set
          * @return the dsl builder
          */
-        default CouchDbEndpointConsumerBuilder since(String since) {
-            doSetProperty("since", since);
+        default CouchDbEndpointConsumerBuilder resumeStrategy(
+                String resumeStrategy) {
+            doSetProperty("resumeStrategy", resumeStrategy);
             return this;
         }
         /**
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_13.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_13.adoc
index 78d7d19..07942dc 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_13.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_13.adoc
@@ -111,3 +111,7 @@ their applications when upgrading to ensure this continues 
to work.
 
 Support for rendering api docs by discovering other CamelContext via JMX in 
the same JVM has been removed.
 Rendering of api docs is now only supported for the same CamelContext.
+
+=== camel-couchdb
+
+The `since` configuration was replaced by the `resumeStrategy`. Integrations 
can now manage the last update sequence for tracking the changes directly. 
Check the samples section on the component documentation page for a sample.

Reply via email to