You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2017/01/22 14:05:41 UTC

[1/2] camel git commit: CAMEL-10734: Add support to track changes from specific sequence

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 <bo...@gmail.com>
Authored: Sun Jan 22 10:36:05 2017 +0100
Committer: Claus Ibsen <da...@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;
+    }
 }


[2/2] camel git commit: Add lable to options. This closes #1417

Posted by da...@apache.org.
Add lable to options. This closes #1417


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

Branch: refs/heads/master
Commit: bac2b54c9abe9007fd1aec227b4693b15699ac87
Parents: 7c1528f
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Jan 22 15:05:14 2017 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Jan 22 15:05:14 2017 +0100

----------------------------------------------------------------------
 .../src/main/docs/couchdb-component.adoc              | 14 +++++++-------
 .../camel/component/couchdb/CouchDbEndpoint.java      | 14 +++++++-------
 2 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/bac2b54c/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 ccc42c9..0081fa1 100644
--- a/components/camel-couchdb/src/main/docs/couchdb-component.adoc
+++ b/components/camel-couchdb/src/main/docs/couchdb-component.adoc
@@ -59,17 +59,17 @@ The CouchDB component supports 16 endpoint options which are listed below:
 | port | common | 5984 | int | Port number for the running couchdb instance
 | database | common |  | String | *Required* Name of the database to use
 | createDatabase | common | false | boolean | Creates the database if it does not already exist
-| 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
 | bridgeErrorHandler | consumer | false | boolean | 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 message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN or ERROR level and ignored.
+| deletes | consumer | true | boolean | Document deletes are published as events
+| heartbeat | consumer | 30000 | long | How often to send an empty message to keep socket alive in millis
+| since | consumer |  | String | Start tracking changes immediately after the given update sequence. The default null will start monitoring from the latest sequence.
+| style | consumer | 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 | consumer | true | boolean | Document inserts/updates are published as events
 | exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN or ERROR level and ignored.
 | exchangePattern | consumer (advanced) |  | ExchangePattern | Sets the exchange pattern when the consumer creates an exchange.
 | synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+| password | security |  | String | Password for authenticated databases
+| username | security |  | String | Username in case of authenticated databases
 |=======================================================================
 {% endraw %}
 // endpoint options: END

http://git-wip-us.apache.org/repos/asf/camel/blob/bac2b54c/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 bd51b66..c4e7904 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
@@ -50,21 +50,21 @@ public class CouchDbEndpoint extends DefaultEndpoint {
     private int port;
     @UriPath @Metadata(required = "true")
     private String database;
-    @UriParam(enums = "all_docs,main_only", defaultValue = DEFAULT_STYLE)
+    @UriParam(label = "consumer", enums = "all_docs,main_only", defaultValue = DEFAULT_STYLE)
     private String style = DEFAULT_STYLE;
-    @UriParam
+    @UriParam(label = "security", secret = true)
     private String username;
-    @UriParam
+    @UriParam(label = "security", secret = true)
     private String password;
-    @UriParam(defaultValue = "" + DEFAULT_HEARTBEAT)
+    @UriParam(label = "consumer", defaultValue = "" + DEFAULT_HEARTBEAT)
     private long heartbeat = DEFAULT_HEARTBEAT;
     @UriParam
     private boolean createDatabase;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "consumer", defaultValue = "true")
     private boolean deletes = true;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "consumer", defaultValue = "true")
     private boolean updates = true;
-    @UriParam
+    @UriParam(label = "consumer")
     private String since;
 
     public CouchDbEndpoint() {