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

Re: Filtering with File component again


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


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

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.
> 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
----------------- @davsclaus
Camel in Action 2: