camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-10734: Add support to track changes from specific sequence
Date Sun, 22 Jan 2017 14:05:41 GMT
Repository: camel
Updated Branches:
  refs/heads/master 4fbeac680 -> bac2b54c9


CAMEL-10734: Add support to track changes from specific sequence


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7c1528f1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7c1528f1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7c1528f1

Branch: refs/heads/master
Commit: 7c1528f18420ab6bd37478d2928d64842627958c
Parents: 4fbeac6
Author: Bobo Häggström <bobo.haggstrom@gmail.com>
Authored: Sun Jan 22 10:36:05 2017 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Jan 22 14:59:21 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/couchdb-component.adoc              |  5 +++--
 .../component/couchdb/CouchDbChangesetTracker.java    |  9 ++++++---
 .../camel/component/couchdb/CouchDbEndpoint.java      | 14 ++++++++++++++
 3 files changed, 23 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7c1528f1/components/camel-couchdb/src/main/docs/couchdb-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-couchdb/src/main/docs/couchdb-component.adoc b/components/camel-couchdb/src/main/docs/couchdb-component.adoc
index 14ada92..ccc42c9 100644
--- a/components/camel-couchdb/src/main/docs/couchdb-component.adoc
+++ b/components/camel-couchdb/src/main/docs/couchdb-component.adoc
@@ -48,7 +48,7 @@ The CouchDB component has no options.
 // component options: END
 
 // endpoint options: START
-The CouchDB component supports 15 endpoint options which are listed below:
+The CouchDB component supports 16 endpoint options which are listed below:
 
 {% raw %}
 [width="100%",cols="2,1,1m,1m,5",options="header"]
@@ -62,6 +62,7 @@ The CouchDB component supports 15 endpoint options which are listed below:
 | deletes | common | true | boolean | Document deletes are published as events
 | heartbeat | common | 30000 | long | How often to send an empty message to keep socket alive
in millis
 | password | common |  | String | Password for authenticated databases
+| since | common |  | String | Start tracking changes immediately after the given update
sequence. The default null will start monitoring from the latest sequence.
 | style | common | main_only | String | 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 (including conflicts and deleted former conflicts.)
 | updates | common | true | boolean | Document inserts/updates are published as events
 | username | common |  | String | Username in case of authenticated databases
@@ -132,4 +133,4 @@ exchange is used
 [source,java]
 ----------------------------------------------------------------------------------------
 from("someProducingEndpoint").process(someProcessor).to("couchdb:http://localhost:9999")
-----------------------------------------------------------------------------------------
\ No newline at end of file
+----------------------------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/camel/blob/7c1528f1/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbChangesetTracker.java
----------------------------------------------------------------------
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 5b2baf3..fcc7c51 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
@@ -42,9 +42,12 @@ public class CouchDbChangesetTracker implements Runnable {
     }
 
     void initChanges() {
-        CouchDbInfo dbInfo = couchClient.context().info();
-        String since = dbInfo.getUpdateSeq(); // get latest update seq
-        LOG.debug("Last sequence [{}]", since);
+        String since = endpoint.getSince();
+        if (since == null) {
+            CouchDbInfo dbInfo = couchClient.context().info();
+            since = dbInfo.getUpdateSeq(); // get latest update seq
+            LOG.debug("Last sequence [{}]", since);
+        }
         changes = couchClient.changes().style(endpoint.getStyle()).includeDocs(true)
                 .since(since).heartBeat(endpoint.getHeartbeat()).continuousChanges();
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/7c1528f1/components/camel-couchdb/src/main/java/org/apache/camel/component/couchdb/CouchDbEndpoint.java
----------------------------------------------------------------------
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 005ad4d..bd51b66 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
@@ -64,6 +64,8 @@ public class CouchDbEndpoint extends DefaultEndpoint {
     private boolean deletes = true;
     @UriParam(defaultValue = "true")
     private boolean updates = true;
+    @UriParam
+    private String since;
 
     public CouchDbEndpoint() {
     }
@@ -244,4 +246,16 @@ public class CouchDbEndpoint extends DefaultEndpoint {
     public void setUpdates(boolean updates) {
         this.updates = updates;
     }
+
+    public String getSince() {
+        return since;
+    }
+
+    /**
+     * Start tracking changes immediately after the given update sequence.
+     * The default, null, will start monitoring from the latest sequence.
+     */
+    public void setSince(String since) {
+        this.since = since;
+    }
 }


Mime
View raw message