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/12/13 09:39:56 UTC
[camel] branch master updated: CAMEL-12020: Fixed test and
corrected the polling file consumer.
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new b9be88e CAMEL-12020: Fixed test and corrected the polling file consumer.
b9be88e is described below
commit b9be88efaed36c77873d5a9a2e9d30327263f227
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Dec 13 10:39:29 2017 +0100
CAMEL-12020: Fixed test and corrected the polling file consumer.
---
.../org/apache/camel/component/file/GenericFilePollingConsumer.java | 3 +++
.../org/apache/camel/component/file/FileConsumeTemplateTest.java | 5 +++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
index 09f6bcf..34c78f1 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java
@@ -44,7 +44,10 @@ public class GenericFilePollingConsumer extends EventDrivenPollingConsumer {
GenericFileConsumer consumer = (GenericFileConsumer) super.createConsumer();
// do not start scheduler as we poll manually
consumer.setStartScheduler(false);
+ // when using polling consumer we poll only 1 file per poll so we can limit
consumer.setMaxMessagesPerPoll(1);
+ // however do not limit eager as we may sort the files and thus need to do a full scan so we can sort afterwards
+ consumer.setEagerLimitMaxMessagesPerPoll(false);
// we only want to poll once so disconnect by default
return consumer;
}
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeTemplateTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeTemplateTest.java
index a7f9859..123954b 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeTemplateTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeTemplateTest.java
@@ -43,8 +43,9 @@ public class FileConsumeTemplateTest extends ContextTestSupport {
String body = out.getIn().getBody(String.class);
String body2 = out2.getIn().getBody(String.class);
- assertEquals("Hello World", body);
- assertEquals("Bye World", body2);
+ // bye should come before hello (eg sorted a..z by file name)
+ assertEquals("Bye World", body);
+ assertEquals("Hello World", body2);
}
}
--
To stop receiving notification emails like this one, please contact
['"commits@camel.apache.org" <co...@camel.apache.org>'].