This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 2e7dfd170eb CAMEL-22181: poll/pollEnrich should support eager limit option for file based components so it can be faster out of the box. 2e7dfd170eb is described below commit 2e7dfd170ebbe22ada69587a605f2f19b937345e Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Thu Jun 19 11:13:03 2025 +0200 CAMEL-22181: poll/pollEnrich should support eager limit option for file based components so it can be faster out of the box. --- .../camel/component/file/GenericFilePollingConsumer.java | 13 ++++++++----- .../src/main/docs/modules/eips/pages/poll-eip.adoc | 9 +++++++++ .../src/main/docs/modules/eips/pages/pollEnrich-eip.adoc | 9 +++++++++ .../modules/ROOT/pages/camel-4x-upgrade-guide-4_13.adoc | 9 +++++++++ 4 files changed, 35 insertions(+), 5 deletions(-) diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java index 4f29e6358ac..9289d431ede 100644 --- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java +++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFilePollingConsumer.java @@ -37,18 +37,21 @@ public class GenericFilePollingConsumer extends EventDrivenPollingConsumer imple this.delay = endpoint.getDelay() > 0 ? endpoint.getDelay() : endpoint.getDefaultDelay(); } + @Override + public GenericFileEndpoint getEndpoint() { + return (GenericFileEndpoint) super.getEndpoint(); + } + @Override protected Consumer createConsumer() throws Exception { // lets add ourselves as a consumer 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 + // 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); + // respect the eager limit (true is faster but does not respect when need to sort all files first) + consumer.setEagerLimitMaxMessagesPerPoll(getEndpoint().isEagerMaxMessagesPerPoll()); // we only want to poll once so disconnect by default return consumer; } diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc index 0aa56dedb46..b83a1ff76f8 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/poll-eip.adoc @@ -109,6 +109,15 @@ for example, download a file from xref:ROOT:aws2-s3-component.adoc[AWS S3] as th </rest> ---- +=== Using Poll with file based components + +When using `poll` or `pollEnrich` with the file based components, then the `eagerLimitMaxMessagesPerPoll` option +has changed default from `false` to `true` from **Camel 4.13** onwards. Only use-cases where you need to sort the files first, +requires to explicit set the option `eagerLimitMaxMessagesPerPoll=false` to make Camel scan for all files first before sorting, +and then `poll` or `pollEnrich` will then pick the top file after the sorting. + +This improves performance for use-cases without need for sorting first. + == See More - xref:poll-eip.adoc[Poll EIP] diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc index 98e7e6b204f..b7e5a9c4566 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/pollEnrich-eip.adoc @@ -188,6 +188,15 @@ XML:: TIP: See the `cacheSize` option for more details on _how much cache_ to use depending on how many or few unique endpoints are used. +=== Using Poll Enrich with file based components + +When using `poll` or `pollEnrich` with the file based components, then the `eagerLimitMaxMessagesPerPoll` option +has changed default from `false` to `true` from **Camel 4.13** onwards. Only use-cases where you need to sort the files first, +requires to explicit set the option `eagerLimitMaxMessagesPerPoll=false` to make Camel scan for all files first before sorting, +and then `poll` or `pollEnrich` will then pick the top file after the sorting. + +This improves performance for use-cases without need for sorting first. + == See More - xref:poll-eip.adoc[Poll EIP] diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_13.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_13.adoc index b437294380c..58c91378345 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_13.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_13.adoc @@ -11,6 +11,15 @@ from both 4.0 to 4.1 and 4.1 to 4.2. Added a 2nd `lookup` method to `org.apache.camel.spi.TypeConverterRegistry` and changed the `addConverter` to no longer have an empty default noop implementation in the interface. +=== camel-file / camel-ftp / camel-smb + +When using `poll` or `pollEnrich` with the file based components, then the `eagerLimitMaxMessagesPerPoll` option +has changed default from `false` to `true`. Only use-cases where you need to sort the files first, +requires to explicit set the option `eagerLimitMaxMessagesPerPoll=false` to make Camel scan for all files first before sorting, +and then `poll` or `pollEnrich` will then pick the top file after the sorting. + +This improves performance for use-cases without need for sorting first. + === camel-http Renamed class `org.apache.camel.component.http.BasicAuthenticationHttpClientConfigurer` to `org.apache.camel.component.http.DefaultAuthenticationHttpClientConfigurer`.