git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filtering with File component again


Hi

You can just tell Camel to only include the XML files,

 from("file:loans?include=.*xml")

Mind that include is using java regular expression, so its .* to
indicate any kind of charachters and then ending with xml.

https://github.com/apache/camel/blob/master/camel-core/src/main/docs/file-component.adoc

On Tue, Mar 6, 2018 at 10:46 AM, Meissa Sakho <mbsakho@xxxxxxxxx> wrote:
> Hello everyone,
> I have a use case that is a little bit different from my last post with the
> File component.
> https://mail.google.com/mail/u/0/#label/apache-camel/161b75aa802e2f9f
>
> In this case, the requirements are:
> 1) The route will pool a source folder and takes only files whose name ends
> with .xml
> 2) The source file content must be saved into a single journal file named
> loan.xml
> 3)If a file name does not end with .xml, it should not be processed or be
> removed.
> Only files that ends with .xml should be processed.
> below is the extract of my route.
>
>
> public void configure() throws Exception {
>
>    from("file:loans")
>            .choice()
>                .when(header("CamelFileName").endsWith(".xml"))
>                    .log("XML loan processed: ${header.camelFileName}")
>
> .to("file:loans/results?fileName=loan.txt&fileExist=Append")
>
>
> I don't know yet how to handle the second part so that files with no .xml
> extension are left in the loans folders.
> Any idea?
>
> Thanks,
> Meissa



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2



( ! ) Warning: include(msgfooter.php): failed to open stream: No such file or directory in /var/www/git/apache-camel-users/msg03114.html on line 121
Call Stack
#TimeMemoryFunctionLocation
10.0008364568{main}( ).../msg03114.html:0

( ! ) Warning: include(): Failed opening 'msgfooter.php' for inclusion (include_path='.:/var/www/git') in /var/www/git/apache-camel-users/msg03114.html on line 121
Call Stack
#TimeMemoryFunctionLocation
10.0008364568{main}( ).../msg03114.html:0