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 2013/08/14 15:08:57 UTC
[1/3] git commit: CAMEL-6635: PollingConsumer from a scheduled
consumer such as file/ftp can use a regular thread pool instead of being
scheduled
Updated Branches:
refs/heads/camel-2.11.x 21ea2d63f -> e3db2228a
refs/heads/master 12fd86170 -> f099af733
CAMEL-6635: PollingConsumer from a scheduled consumer such as file/ftp can use a regular thread pool instead of being scheduled
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c7ebd0c1
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c7ebd0c1
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c7ebd0c1
Branch: refs/heads/master
Commit: c7ebd0c13b95c108e91584d2a3625a780bf3844c
Parents: 12fd861
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 14 14:47:23 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 14 14:47:23 2013 +0200
----------------------------------------------------------------------
.../org/apache/camel/impl/ScheduledPollConsumer.java | 5 ++++-
.../java/org/apache/camel/processor/PollEnricher.java | 3 ++-
.../camel/component/file/FilePollEnrichNoWaitTest.java | 13 +++----------
3 files changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c7ebd0c1/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
index 546b83a..ce015da 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/ScheduledPollConsumer.java
@@ -469,7 +469,10 @@ public abstract class ScheduledPollConsumer extends DefaultConsumer implements R
LOG.trace("Before poll {}", getEndpoint());
}
scheduler.scheduleTask(this);
- return timeout;
+
+ // ensure at least timeout is as long as one poll delay normally is
+ // to give the poll a chance to run once
+ return Math.max(timeout, getDelay());
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/c7ebd0c1/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java b/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
index 699362e..c79d3c9 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
@@ -94,7 +94,8 @@ public class PollEnricher extends ServiceSupport implements AsyncProcessor {
/**
* Sets the timeout to use when polling.
* <p/>
- * Use 0 or negative to not use timeout and block until data is available.
+ * Use 0 to use receiveNoWait,
+ * Use -1 to use receive with no timeout (which will block until data is available).
*
* @param timeout timeout in millis.
*/
http://git-wip-us.apache.org/repos/asf/camel/blob/c7ebd0c1/camel-core/src/test/java/org/apache/camel/component/file/FilePollEnrichNoWaitTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FilePollEnrichNoWaitTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FilePollEnrichNoWaitTest.java
index 3f8baf4..61b0435 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FilePollEnrichNoWaitTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FilePollEnrichNoWaitTest.java
@@ -17,11 +17,9 @@
package org.apache.camel.component.file;
import java.io.File;
-import java.util.concurrent.TimeUnit;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -58,19 +56,14 @@ public class FilePollEnrichNoWaitTest extends ContextTestSupport {
public void configure() throws Exception {
from("timer:foo?period=1000").routeId("foo")
.log("Trigger timer foo")
- .pollEnrich("file:target/pollenrich?move=done")
+ // use 0 as timeout for no wait
+ .pollEnrich("file:target/pollenrich?move=done", 0)
.convertBodyTo(String.class)
.filter(body().isNull())
.stop()
.end()
.log("Polled filed ${file:name}")
- .to("mock:result")
- .process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- // force stop route after use to prevent firing timer again
- exchange.getContext().stopRoute("foo", 100, TimeUnit.MILLISECONDS);
- }
- });
+ .to("mock:result");
}
};
}
[3/3] git commit: CAMEL-6637: Beanio should log invalid at DEBUG
level if configured to ignore. Thanks to Sam Lewis for the patch.
Posted by da...@apache.org.
CAMEL-6637: Beanio should log invalid at DEBUG level if configured to ignore. Thanks to Sam Lewis for the patch.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e3db2228
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e3db2228
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e3db2228
Branch: refs/heads/camel-2.11.x
Commit: e3db2228af66d6b2b5559ff4ade9002d31271d1e
Parents: 21ea2d6
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 14 14:55:55 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 14 15:08:40 2013 +0200
----------------------------------------------------------------------
.../dataformat/beanio/BeanIODataFormat.java | 24 ++++++++++++--------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e3db2228/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
index 75e5ffb..63b8632 100644
--- a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
+++ b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
@@ -163,27 +163,33 @@ public class BeanIODataFormat extends ServiceSupport implements DataFormat, Came
@Override
public void invalidRecord(InvalidRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText());
-
- if (!ignoreInvalidRecords) {
+ String msg = LOG_PREFIX + "InvalidRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText();
+ if (ignoreInvalidRecords) {
+ LOG.debug(msg);
+ } else {
+ LOG.warn(msg);
throw ex;
}
}
@Override
public void unexpectedRecord(UnexpectedRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText());
-
- if (!ignoreUnexpectedRecords) {
+ String msg = LOG_PREFIX + "UnexpectedRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText();
+ if (ignoreUnexpectedRecords) {
+ LOG.debug(msg);
+ } else {
+ LOG.warn(msg);
throw ex;
}
}
@Override
public void unidentifiedRecord(UnidentifiedRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText());
-
- if (!ignoreUnidentifiedRecords) {
+ String msg = LOG_PREFIX + "UnidentifiedRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText();
+ if (ignoreUnidentifiedRecords) {
+ LOG.debug(msg);
+ } else {
+ LOG.warn(msg);
throw ex;
}
}
[2/3] git commit: CAMEL-6637: Beanio should log invalid at DEBUG
level if configured to ignore. Thanks to Sam Lewis for the patch.
Posted by da...@apache.org.
CAMEL-6637: Beanio should log invalid at DEBUG level if configured to ignore. Thanks to Sam Lewis for the patch.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f099af73
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f099af73
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f099af73
Branch: refs/heads/master
Commit: f099af7339a917261938f54e3c4e352ac90064e2
Parents: c7ebd0c
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Aug 14 14:55:55 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Aug 14 14:55:55 2013 +0200
----------------------------------------------------------------------
.../dataformat/beanio/BeanIODataFormat.java | 24 ++++++++++++--------
1 file changed, 15 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f099af73/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
index 75e5ffb..63b8632 100644
--- a/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
+++ b/components/camel-beanio/src/main/java/org/apache/camel/dataformat/beanio/BeanIODataFormat.java
@@ -163,27 +163,33 @@ public class BeanIODataFormat extends ServiceSupport implements DataFormat, Came
@Override
public void invalidRecord(InvalidRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText());
-
- if (!ignoreInvalidRecords) {
+ String msg = LOG_PREFIX + "InvalidRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText();
+ if (ignoreInvalidRecords) {
+ LOG.debug(msg);
+ } else {
+ LOG.warn(msg);
throw ex;
}
}
@Override
public void unexpectedRecord(UnexpectedRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText());
-
- if (!ignoreUnexpectedRecords) {
+ String msg = LOG_PREFIX + "UnexpectedRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText();
+ if (ignoreUnexpectedRecords) {
+ LOG.debug(msg);
+ } else {
+ LOG.warn(msg);
throw ex;
}
}
@Override
public void unidentifiedRecord(UnidentifiedRecordException ex) throws Exception {
- LOG.warn(LOG_PREFIX + ex.getMessage() + ": " + ex.getRecordContext().getRecordText());
-
- if (!ignoreUnidentifiedRecords) {
+ String msg = LOG_PREFIX + "UnidentifiedRecord: " + ex.getMessage() + ": " + ex.getRecordContext().getRecordText();
+ if (ignoreUnidentifiedRecords) {
+ LOG.debug(msg);
+ } else {
+ LOG.warn(msg);
throw ex;
}
}