Hi

Yeah you can add an onCompletion to the route, that triggers when the
batch is done, and then send a message to the controlbus to stop the
route.

http://camel.apache.org/oncompletion.html

Something a like this:

onCompletion().onWhen(header(Exchange.CamelBatchComplete))
   .to("controlbus:route?routeId=foo&action=stop").end();

But if all you do is moving files from one dir to another, you can
also write some java code that does that.


On Sun, May 4, 2014 at 10:22 AM, Chirag Dewan <chirag.dewa...@yahoo.in> wrote:
> Hi Claus,
>
> Thanks for the quick reply.
>
> I have to consume all the files upon a command,and then stop the route from 
> continuously polling the files untill the next command comes. So,can I also 
> stop the control bus once all my files are consumed? Maybe from within the 
> route?
>
> BR,
>
> Chirag Dewan
>
>
>
> ________________________________
>  From: Claus Ibsen <claus.ib...@gmail.com>
> To: "users@camel.apache.org" <users@camel.apache.org>
> Sent: Sunday, 4 May 2014 1:23 PM
> Subject: Re: pollEnrich all the files in a directory
>
>
> On Sun, May 4, 2014 at 9:38 AM, Chirag Dewan <chirag.dewa...@yahoo.in> wrote:
>> Hi,
>>
>> Can I consume all the files in a directory,using poll enrich?
>>
>> My route would be something like :
>>
>> from("seda:abc").pollEnrich("file:/path/of/directory?delete=true).to("file:/path/of/output);
>>
>> And I send requests to the route with null body or blank body.
>>
>> context.createProducerTemplate().sendBody("seda:abc",null/"");
>>
>> BR,
>>
>> Chirag Dewan
>
>
> Hi
>
> No pollEnrich polls one file at a time.
>
> You may try to use the control bus instead, to start a route that
> moves the files.
>
> route id = foo
> from file dir
>   to file outdir
>
> And then use controlbus to send a message to start route with id = foo
>
> http://camel.apache.org/controlbus
>
>
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> hawtio: http://hawt.io/
> fabric8: http://fabric8.io/



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to