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 ABDC4200D45 for ; Thu, 23 Nov 2017 08:55:06 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id AA369160BFE; Thu, 23 Nov 2017 07:55:06 +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 F074D160BEF for ; Thu, 23 Nov 2017 08:55:05 +0100 (CET) Received: (qmail 17744 invoked by uid 500); 23 Nov 2017 07:55:04 -0000 Mailing-List: contact issues-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 issues@camel.apache.org Received: (qmail 17735 invoked by uid 99); 23 Nov 2017 07:55:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Nov 2017 07:55:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 9321ECB711 for ; Thu, 23 Nov 2017 07:55:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.011 X-Spam-Level: X-Spam-Status: No, score=-99.011 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KB_WAM_FROM_NAME_SINGLEWORD=0.2, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id ZzXmqdcEgxoE for ; Thu, 23 Nov 2017 07:55:01 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 2EFC15FBEE for ; Thu, 23 Nov 2017 07:55:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A2AEBE126D for ; Thu, 23 Nov 2017 07:55:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 59D33241A8 for ; Thu, 23 Nov 2017 07:55:00 +0000 (UTC) Date: Thu, 23 Nov 2017 07:55:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CAMEL-11656) Support default directory sorter for FileConsumer MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 23 Nov 2017 07:55:06 -0000 [ https://issues.apache.org/jira/browse/CAMEL-11656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16263928#comment-16263928 ] ASF GitHub Bot commented on CAMEL-11656: ---------------------------------------- davsclaus commented on issue #2108: CAMEL-11656 - add preSort option URL: https://github.com/apache/camel/pull/2108#issuecomment-346549840 Maybe we can improved the documentation a bit, something like: ``` When pre-sort is enabled then the consumer will sort the file and directory names during polling, that was retrieved from the file system. You may want to do this in case you need to operate on the files in a sorted order. The pre-sort is executed before the consumer starts to filter, and accept files to process by Camel. This option is default disabled. ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org > Support default directory sorter for FileConsumer > ------------------------------------------------- > > Key: CAMEL-11656 > URL: https://issues.apache.org/jira/browse/CAMEL-11656 > Project: Camel > Issue Type: Improvement > Components: camel-core > Affects Versions: 2.19.0 > Reporter: Viktor Khoroshko > Priority: Minor > Fix For: 2.21.0 > > > Hello, > The current way of sorting consumed files isn't very flexible due to how it's implemented: > Files are sorted AFTER they're added to in progress repository what in combination with *maxMessagesPerPoll* set to be > 0 and *eagerLimitMaxMessagesPerPoll* set to false forces the *removeExcessiveInProgressFiles* call - which in case of persistent idempotent repository used causes redundant calls to a database. > This is not only the issue. > In my case I have a logic in a custom file filter that a file shouldn't be processed if a file with a same prefix is already in progress while still those files should be processed in a specified order. > The issue is that since sorting is performed after each file is added to in progress repository and before added there a file should be accepted by a filter but it will be not - as a previous file with a same prefix has already been added to in progress repo. > *Example*: files - test.001, test.002, test.003 > If test.003 is first in a returned file list then it will be added to in progress repository and next files will not be accepted due to the same prefix. > Default sorting would solve this issue. > It would be great if default sorter can be specified for *FileConsumer* in the pollDirectory method: > {code:java} > log.trace("Polling directory: {}", directory.getPath()); > File[] dirFiles = directory.listFiles(); > if (dirFiles == null || dirFiles.length == 0) { > // no files in this directory to poll > if (log.isTraceEnabled()) { > log.trace("No files found in directory: {}", directory.getPath()); > } > return true; > } else { > // we found some files > if (log.isTraceEnabled()) { > log.trace("Found {} in directory: {}", dirFiles.length, directory.getPath()); > } > } > List files = Arrays.asList(dirFiles); > // sort there? > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)