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 CDE22200D37 for ; Thu, 9 Nov 2017 15:06:09 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id CCB1F160BEF; Thu, 9 Nov 2017 14:06:09 +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 1EB691609E5 for ; Thu, 9 Nov 2017 15:06:08 +0100 (CET) Received: (qmail 51957 invoked by uid 500); 9 Nov 2017 14:06:08 -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 51948 invoked by uid 99); 9 Nov 2017 14:06:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Nov 2017 14:06:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6A51C1807BF for ; Thu, 9 Nov 2017 14:06:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id AR8klvzPpC_8 for ; Thu, 9 Nov 2017 14:06:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 395EB5FC9D for ; Thu, 9 Nov 2017 14:06: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 7872FE00B3 for ; Thu, 9 Nov 2017 14:06: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 3944F240CE for ; Thu, 9 Nov 2017 14:06:00 +0000 (UTC) Date: Thu, 9 Nov 2017 14:06:00 +0000 (UTC) From: "Viktor Khoroshko (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (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, 09 Nov 2017 14:06:10 -0000 [ https://issues.apache.org/jira/browse/CAMEL-11656?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16245700#comment-16245700 ] Viktor Khoroshko edited comment on CAMEL-11656 at 11/9/17 2:05 PM: ------------------------------------------------------------------- Just sort list of files found alphabetically by default in the code placeholder "// sort there" from above description. was (Author: oceansize): Just sort list of files of found alphabetically by default in the code placeholder "// sort there" from above description. > Support default directory sorter for FileConsumer > ------------------------------------------------- > > Key: CAMEL-11656 > URL: https://issues.apache.org/jira/browse/CAMEL-11656 > Project: Camel > Issue Type: Wish > Components: camel-core > Affects Versions: 2.19.0 > Reporter: Viktor Khoroshko > Priority: Minor > Fix For: Future > > > 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)