-
1. Re: Camel Route File Polling Mechanism
ffang Mar 17, 2013 11:29 PM (in response to mari_yaguchi)Hi,
You can use sorter or sortBy option for camel-file endpoint, take a look at to get more details
http://camel.apache.org/file2.html
Freeman
-
2. Re: Camel Route File Polling Mechanism
mari_yaguchi Mar 17, 2013 11:43 PM (in response to ffang)Thanks ffang for your answer.
But, i want to know too about the default mechanism of Camel to polling and send file without set the "sortBy" option, is it really random? or there is some logics there? Thanks
-
3. Re: Camel Route File Polling Mechanism
ffang Mar 18, 2013 12:25 AM (in response to mari_yaguchi)AFAK if there's no sorter or sortBy specified, it just build a list using the return array of java.io.File.listFiles(), take a look at comment from java.io.File.listFiles()
* <p> There is no guarantee that the name strings in the resulting array * will appear in any specific order; they are not, in particular, * guaranteed to appear in alphabetical order.
So there's no guarantee order per JDK implementation.
Freeman
-
4. Re: Camel Route File Polling Mechanism
mari_yaguchi Mar 18, 2013 12:36 AM (in response to ffang)Thanks for the answer ffang its really helpfull,
I just find something here, i tried to run the camel in windows and linux. In windows, Camel poll and send the file based on alphabetical order, and in linux its not. So i guessed the OS here also determined the order?
-
5. Re: Camel Route File Polling Mechanism
ffang Mar 18, 2013 1:22 AM (in response to mari_yaguchi)It could be.
Most likely java.io.File.listFiles() need call into OS native API to get files under a certain folder so the behavior isn't identical across platforms.
Freeman
-
6. Re: Camel Route File Polling Mechanism
mari_yaguchi Mar 18, 2013 1:39 AM (in response to ffang)Thanks for the explanation. Really appreciate that
-
7. Re: Camel Route File Polling Mechanism
davsclaus Mar 18, 2013 6:55 AM (in response to mari_yaguchi)You can use the sortBy or sorter option on the file component to sort the files
-
8. Re: Camel Route File Polling Mechanism
mari_yaguchi Mar 20, 2013 5:00 AM (in response to ffang)-- Edited --
Edited by: mari_yaguchi on Mar 20, 2013 8:59 AM
-
9. Re: Camel Route File Polling Mechanism
mari_yaguchi Mar 20, 2013 4:59 AM (in response to davsclaus)Hi,
I just want to know if there is no specific order when Camel poll the file, how can I get the same order if I try to run a route twice? it exactly give me the same order.
-
10. Re: Camel Route File Polling Mechanism
davsclaus Mar 20, 2013 6:39 AM (in response to mari_yaguchi)Its the OS / JVM that returns the list in the order it decides to do. So it may appear in the same order.