Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C24BC200C13 for ; Sun, 22 Jan 2017 15:05:43 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id BF8D6160B38; Sun, 22 Jan 2017 14:05:43 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E9E68160B45 for ; Sun, 22 Jan 2017 15:05:42 +0100 (CET) Received: (qmail 30537 invoked by uid 500); 22 Jan 2017 14:05:42 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 30518 invoked by uid 99); 22 Jan 2017 14:05:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 22 Jan 2017 14:05:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id AF050DFCBD; Sun, 22 Jan 2017 14:05:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: davsclaus@apache.org To: commits@camel.apache.org Date: Sun, 22 Jan 2017 14:05:41 -0000 Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: [1/2] camel git commit: CAMEL-10734: Add support to track changes from specific sequence archived-at: Sun, 22 Jan 2017 14:05:43 -0000 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 Authored: Sun Jan 22 10:36:05 2017 +0100 Committer: Claus Ibsen 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; + } }