camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: How to consume csv files only in file componant
Date Tue, 12 Mar 2013 09:17:21 GMT
On Tue, Mar 12, 2013 at 9:49 AM, sarfaraj <sarfarajsayyad@gmail.com> wrote:
> Hi,
>
> I have camel route with
> <from uri="file:src/test_fs?delete=true" />.
> <to uri="file:src/local_fs" />
>
> Here every files on test_fs got copied to local_fs and original one got
> deleted from test_fs.
> But I want to consume only csv files not the others. (Even  I don't  want to
> delete other files)
>
> I can use  <choice> <when><simple>${file:ext} == 'csv'</simple>
to process
> only csv files. But the issue is other extension files also got deleted
> because of delete=true in from tag.
>
> In short i dont want to touch other than csv files in from componant
>
> Is it possible ? How ?
>

See the file documentation
http://camel.apache.org/file2

There is an include option that uses java reg exp pattern, eg

include=.*csv

To include files ending with csv

But there is also an antInclude option that maybe is more readable

antInclude=*.csv

And you can also implement a custom filter and use java code to
compute if the file should be included or not.




> /Sarfaraj
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/How-to-consume-csv-files-only-in-file-componant-tp5728970.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
View raw message