You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by rbielby <ra...@shopbop.com> on 2009/04/23 17:52:06 UTC

Filter from files

I know this should be very simple, but I can't for the life of me get this to
work.

I'm trying to filter my "from" files using a simple pattern.  I've tried the
include, but possibly my regex is incorrect.  I've also tried the filter
method with no luck either.

I'd like to only consume files that are named similar to this...
test.log.2009-04-23-98.  And not files such as test.log.

This is what I'm currently trying

        from("file:" + config.getLogURL() 
               +
"?include=clickstream.log.([0-9-]+)&move=backup/${date:now:yyyyMMdd}/${file:name}&idempotent="
+ config.getIdempotent())


If I remove the regex pattern and hard code some date
(clickstream.log.2009-04-23-99) it will pick up only files with that name.

Thanks
-- 
View this message in context: http://www.nabble.com/Filter-from-files-tp23197424p23197424.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: Filter from files

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Java regexp can be a pain to get working.

Create a java main app and use simple String and System out to try the
regex combo that will match your files.
This is usually what I do.

And some IDEs have a regex plugin you can use to test as well, I think
there is a plugin to IDEA.
For Eclipse I dont know.

Basically get it working with plain java and then try it with Camel.


On Thu, Apr 23, 2009 at 5:52 PM, rbielby <ra...@shopbop.com> wrote:
>
> I know this should be very simple, but I can't for the life of me get this to
> work.
>
> I'm trying to filter my "from" files using a simple pattern.  I've tried the
> include, but possibly my regex is incorrect.  I've also tried the filter
> method with no luck either.
>
> I'd like to only consume files that are named similar to this...
> test.log.2009-04-23-98.  And not files such as test.log.
>
> This is what I'm currently trying
>
>        from("file:" + config.getLogURL()
>               +
> "?include=clickstream.log.([0-9-]+)&move=backup/${date:now:yyyyMMdd}/${file:name}&idempotent="
> + config.getIdempotent())
>
>
> If I remove the regex pattern and hard code some date
> (clickstream.log.2009-04-23-99) it will pick up only files with that name.
>
> Thanks
> --
> View this message in context: http://www.nabble.com/Filter-from-files-tp23197424p23197424.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Apache Camel Reference Card:
http://refcardz.dzone.com/refcardz/enterprise-integration