You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "gustavo.maurizio" <gm...@me.com> on 2016/10/27 11:08:42 UTC
camel 2.18.0 file component filter example
Can someone please provide an example of the new file2 filterFile and
filterDirectory usage with simple expression?
We want to process recursively a directory and its subdirectories but only
matching files or directories (and all its subfiles) that have name YYYYMMDD
lower or equal the run moment.
Any example will do...
thanks!
--
View this message in context: http://camel.465427.n5.nabble.com/camel-2-18-0-file-component-filter-example-tp5789342.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel 2.18.0 file component filter example
Posted by "gustavo.maurizio" <gm...@me.com>.
Thanks Claus, we figured out how to do it. To provide an example:
To process files in a directory on a specific time and date, we create with
other routes a file whose body has the content of the message to post. Files
should be named as 2016-12-28__01-00-58__UTC@some.queue
The filterFile=${file:name} < ${date:now:yyyy-MM-dd__HH-mm} will choose
all files ready to process.
Note that we use < instead of more familiar < since we cannot use
directly the symbol.
We then split the filename at the @ symbol and chose the second part [1] to
send the message to with dynamic endpoint.
<route id="gt.cron.queue" streamCache="true" trace="false">
<from
uri="file://{{nfs.filecron}}?autoCreate=true&autoCreate=true&delay=10000&move=cron.done&moveFailed=cron.error&filterFile=${file:name}
< ${date:now:yyyy-MM-dd__HH-mm}"/>
<convertBodyTo type="java.lang.String" charset="UTF-8"/>
<toD
uri="activemq:queue:${header.CamelFileNameOnly.split('@')[1]}"/>
</route>
--
View this message in context: http://camel.465427.n5.nabble.com/camel-2-18-0-file-component-filter-example-tp5789342p5789436.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel 2.18.0 file component filter example
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
You can try look in the unit tests of camel-core as there is likely
some unit tests covering this functionality.
On Thu, Oct 27, 2016 at 1:08 PM, gustavo.maurizio <gm...@me.com> wrote:
> Can someone please provide an example of the new file2 filterFile and
> filterDirectory usage with simple expression?
> We want to process recursively a directory and its subdirectories but only
> matching files or directories (and all its subfiles) that have name YYYYMMDD
> lower or equal the run moment.
>
> Any example will do...
> thanks!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/camel-2-18-0-file-component-filter-example-tp5789342.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