As Claus has pointed out in the earlier thread, depending on the configuration, listing of files is passed on to the filter for processing. Any new file will be picked up in the next iteration.
-Ravi ________________________________________ From: JKemp [kemp.ja...@gmail.com] Sent: Saturday, February 01, 2014 1:17 AM To: users@camel.apache.org Subject: Re: File Exists Ah, whoops, my fault. I was looking at the File documentation and not at File2. I think I have a working solution, but I'm wondering if I'm going about this in the best way. I set up my route with the filter: <bean id="bothFilesReceivedFilter" class="com.mycompany.BothFilesReceivedFilter" /> <camelContext xmlns="http://camel.apache.org/schema/spring"> <route id="report-file-consolidation"> <from uri="file:///data/input?delete=true&include=.*.txt&maxMessagesPerPoll=10&filter=#bothFilesReceivedFilter" /> <split streaming="true"> <tokenize includeTokens="true" token="\n" group="5000" /> <convertBodyTo type="String" charset="UTF-8" /> <setHeader headerName="CamelFileName"> <constant>output-file.txt</constant> </setHeader> <to uri="log:lineparser?showBody=true&showHeaders=true" /> <to uri="file:///data/output?fileExist=Append" /> </split> </route> </camelContext> And I set my filter up like this: public class BothFilesReceivedFilter<T> implements GenericFileFilter<T> { Logger log = Logger.getLogger(); HashSet<String> namesReceived = new HashSet<String>(); public boolean accept(GenericFile<T> file) { log.debug("Received file named: " + file.getFileName()); namesReceived.add(file.getFileName()); if (file.getFileName().equals("foo.txt")){ return namesReceived.contains("bar.txt"); } else if (file.getFileName().equals("bar.txt")){ return namesReceived.contains("foo.txt"); } else { return false; } } } And this seems to work. Is this sort of what you guys meant? The only thing I don't really like about this solution is that the file filtering still seem to be getting evaluated separately from each other. So with the above solution, after both files have been received, if we receive another input file with the same name, it gets processed immediately even when there isn't the companion file in the input directory as well, because the HashSet still shows that both files have been received. But if I clear out the Set once both files have been received, I think it will ignore the second file. Since I was using maxMessagesPerPoll, I thought this would work as a batch consumer, but I don't see the CamelBatchSize header populated when I print the headers. Is there any way to make the filtering inspect all the files in the batch at once? Am I off track here? Thanks again. -- View this message in context: http://camel.465427.n5.nabble.com/File-Exists-tp5746608p5746675.html Sent from the Camel - Users mailing list archive at Nabble.com. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.