On 14/01/2008, pevgen <[EMAIL PROTECTED]> wrote:
>
> Hello
>
> I started to study camel from simple example - it's copy a file. I found a
> filter clause with 'regex' with the file name.
> can anybody tell me about filter/choice/... with 'regex' (or like) on a BODY
> file.
> file's body is not xml-text, but only simple text.

It should work - though I've not personally tested it :)


>
> src :
> ///////////////////////
>         CamelContext context = new DefaultCamelContext();
>
>         FileComponent fc1 = new FileComponent(context);
>         final Endpoint inFile =
> fc1.createEndpoint("file:testdir/in?noop=true");
>         FileComponent fc2 = new FileComponent(context);
>         final Endpoint outFile = fc2.createEndpoint("file:testdir/out");

BTW you don't need to do the above things, you can just use the URIs
in the route..


>
>         RouteBuilder builder = new RouteBuilder() {
>             public void configure() {
>
> from(inFile).filter(body().regex("^(test)[\\s|\\S]*")).to(outFile);
>             }
>         }
>
>         context.addRoutes(builder);
>         context.start();
> //////////////////

Looks fine to me. What happens when you try it?


-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Reply via email to