It was not required to include the txt filter.
I've removed it and it works. There was some errors elsewhere but the code
above works.

I've borrowed the example from Camel in Action 2 chapter two to handle
another use case (handling extra extension).
The extract of my route look like the following:

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")
            .otherwise()
            .log("Invalid format: ${header.camelFileName}")
            .to("file:loans/badloans")

Meissa

2018-02-21 13:46 GMT+01:00 Claus Ibsen <claus.ib...@gmail.com>:

> Using both include and exclude is a bit meaningless unless there are
> some overlaps.
>
> But here you filter on file extensions, so you cannot have something
> that is both xml and txt.
>
> Also mind its using regular expression syntax, so its technically
> .*xml$  to indicate ends with xml.
>
>
>
> On Wed, Feb 21, 2018 at 8:53 AM, Meissa Sakho <mbsa...@gmail.com> wrote:
> > Hello everyone,
> > I need to write a route with the requirements below:
> > 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 ends with .txt, it should not be included in the
> message.
> >
> > I'm trying to combine the include and the exclude option to achieve this.
> > Below is an extract of my route:
> >
> > public void configure() throws Exception {
> >
> >    from("file:loans?include=.*xml&exclude=.*txt")
> >    .to("file:loans/results?fileName=loan.txt&fileExist=Append");
> >
> >
> > It's not working as expected.
> > Do you have any idea about how to include only files ending with a
> defined
> > value and excluding others?
> >
> > thanks,
> > Meissa
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>

Reply via email to