You can use the filter eip, and then if the batch index == 1 then only call the bean
from filter batch index == 1 bean end On Fri, Nov 13, 2015 at 1:29 PM, dwarakart <dwaraka.ram...@gmail.com> wrote: > Hi All, > > I have a camel route that is a file consumer and relies on the include > format with date and filename in it. The actual files arrive with an > additional timestamp. The camel route is started and stopped dynamically. > When the camel route starts, i need to pick the latest file which i can > achieve using sortBy=reverse:file:modified. > > The problem is that I need to process only the latest file > Ex: > from("file:{srcDir}?include=.*[0-9]{8}_[0-9]{6}_fileName.*") > .bean("myBean", "myProcessMethod"); > > Sample file names > 20141105_063012_fileName.txt > 20141105_123012_fileName.txt > > In this scenario, I wish to process only 20141105_123012_fileName.txt and > ignore the file 20141105_063012_fileName.txt. > > Please suggest the best approach. > > Thanks > Dwaraka > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Pick-latest-file-and-ignore-the-remaining-files-for-a-given-date-tp5773806.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2