Re: Filtering with File component again

2018-03-06 Thread Meissa Sakho
And it works like a charm :-)
Thank you claus.
Meissa

2018-03-06 10:52 GMT+01:00 Claus Ibsen :

> 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  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=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
>


Re: Filtering with File component again

2018-03-06 Thread Claus Ibsen
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  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=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