You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vishal Changrani <vi...@ericsson.com> on 2012/11/16 19:44:20 UTC

Consuming mutiple files with current date as filename suffix?

Hi,
I want to configure an FTP Consumer to consume multiple files such as abcd_20121116.zip, xyz_20121116.zip etc. Basically <filename pattern>_<today's date>.zip.

I tried giving filename=(abcd|xyz)_${date:now:yyyymmdd}.zip as part of the URI but this doesn't consumes abcd_20121116.zip or xyz_20121116.zip. I think the FTP consumer expects a file which starts with (abcd..
And doesn't really look for the regex abcd or xyz.
I changed the URL to contain an include=(abcd|xyz)... rather than a filename but then it doesn't understand the ${date:now:yyyymmdd} file language.

Is there any way to confiure mutiple file consumption with the file langugage or specify a regex with today's date?
Thanks in advance,
Vishal





Re: Consuming mutiple files with current date as filename suffix?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 16, 2012 at 7:44 PM, Vishal Changrani
<vi...@ericsson.com> wrote:
> Hi,
> I want to configure an FTP Consumer to consume multiple files such as abcd_20121116.zip, xyz_20121116.zip etc. Basically <filename pattern>_<today's date>.zip.
>
> I tried giving filename=(abcd|xyz)_${date:now:yyyymmdd}.zip as part of the URI but this doesn't consumes abcd_20121116.zip or xyz_20121116.zip. I think the FTP consumer expects a file which starts with (abcd..
> And doesn't really look for the regex abcd or xyz.
> I changed the URL to contain an include=(abcd|xyz)... rather than a filename but then it doesn't understand the ${date:now:yyyymmdd} file language.
>
> Is there any way to confiure mutiple file consumption with the file langugage or specify a regex with today's date?
> Thanks in advance,
> Vishal
>

The fileName can be configured using the simple language
http://camel.apache.org/simple

It does not allow you to mix regular expression and that date function
from simple language.
Though you may use the OR operator.

fileName=abcd_${date:now:yyyymmdd}.zip || xyz_${date:now:yyyymmdd}.zip

An alternative is to use a java bean, and refer to that bean

fileName=${bean:myBean?method=callMe}



>
>
>



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