You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Okello Nelson <cn...@gmail.com> on 2013/04/16 10:49:41 UTC

Block a Queue until all exchanges are received

Hi Guys,

Having a route DSL as:

from("file:" + classesBaseDir + "/" + fileType +
"/step0?preMove=inprogress&moveFailed=.error&move=.done&readLock=true")
.routeId(dirRepoPrefix + fileType + "-To-" + queuePrefix + fileType +
"_ParsingQ")
.threads(50)
.split().tokenize("\n", 5).streaming().parallelProcessing()
.doTry().to(queuePrefix + fileType + "_ParsingQ?asyncConsumer=true")
.doCatch(Exception.class).to(queuePrefix + fileType + "_InvalidParsingQ");

There's another route that consumes the exchanges of the "...ParsingQ".
However, I want exchanges at "...ParsingQ" to be consumed only when all the
files have been loaded into the queue. Is there a way I can implement this?

Thanks a lot in advance.

Kind Regards,
Okello Nelson.

Re: Block a Queue until all exchanges are received

Posted by Okello Nelson <cn...@gmail.com>.
Hi Claus,

I also came across Route Policy, http://camel.apache.org/routepolicy.html.

>From its description, I think I can use it to selectively run routes. In my
specific use case, I'd like to be able to suspend a route until it receives
all the exchanges, then run it while suspending the next route, etc etc.

Kind Regards,
Okello Nelson.


On Wed, Apr 17, 2013 at 12:31 PM, Okello Nelson <cn...@gmail.com> wrote:

> Thanks a lot, Claus.
>
> Kind Regards,
> Okello Nelson.
>
>
> On Wed, Apr 17, 2013 at 11:07 AM, Claus Ibsen <cl...@gmail.com>wrote:
>
>> Hi
>>
>> You can control the other route for example as, eg to start|stop it etc
>> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>>
>> Or in Camel 2.11 use the control bus component
>> http://camel.apache.org/controlbus.html
>>
>>
>>
>> On Tue, Apr 16, 2013 at 10:49 AM, Okello Nelson <cn...@gmail.com>
>> wrote:
>> > Hi Guys,
>> >
>> > Having a route DSL as:
>> >
>> > from("file:" + classesBaseDir + "/" + fileType +
>> > "/step0?preMove=inprogress&moveFailed=.error&move=.done&readLock=true")
>> > .routeId(dirRepoPrefix + fileType + "-To-" + queuePrefix + fileType +
>> > "_ParsingQ")
>> > .threads(50)
>> > .split().tokenize("\n", 5).streaming().parallelProcessing()
>> > .doTry().to(queuePrefix + fileType + "_ParsingQ?asyncConsumer=true")
>> > .doCatch(Exception.class).to(queuePrefix + fileType +
>> "_InvalidParsingQ");
>> >
>> > There's another route that consumes the exchanges of the "...ParsingQ".
>> > However, I want exchanges at "...ParsingQ" to be consumed only when all
>> the
>> > files have been loaded into the queue. Is there a way I can implement
>> this?
>> >
>> > Thanks a lot in advance.
>> >
>> > Kind Regards,
>> > Okello Nelson.
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> Kind Regards,
> Okello Nelson
> +254 722 137 826
> cn.okello@gmail.com
>



-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.okello@gmail.com

Re: Block a Queue until all exchanges are received

Posted by Okello Nelson <cn...@gmail.com>.
Thanks a lot, Claus.

Kind Regards,
Okello Nelson.


On Wed, Apr 17, 2013 at 11:07 AM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> You can control the other route for example as, eg to start|stop it etc
> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>
> Or in Camel 2.11 use the control bus component
> http://camel.apache.org/controlbus.html
>
>
>
> On Tue, Apr 16, 2013 at 10:49 AM, Okello Nelson <cn...@gmail.com>
> wrote:
> > Hi Guys,
> >
> > Having a route DSL as:
> >
> > from("file:" + classesBaseDir + "/" + fileType +
> > "/step0?preMove=inprogress&moveFailed=.error&move=.done&readLock=true")
> > .routeId(dirRepoPrefix + fileType + "-To-" + queuePrefix + fileType +
> > "_ParsingQ")
> > .threads(50)
> > .split().tokenize("\n", 5).streaming().parallelProcessing()
> > .doTry().to(queuePrefix + fileType + "_ParsingQ?asyncConsumer=true")
> > .doCatch(Exception.class).to(queuePrefix + fileType +
> "_InvalidParsingQ");
> >
> > There's another route that consumes the exchanges of the "...ParsingQ".
> > However, I want exchanges at "...ParsingQ" to be consumed only when all
> the
> > files have been loaded into the queue. Is there a way I can implement
> this?
> >
> > Thanks a lot in advance.
> >
> > Kind Regards,
> > Okello Nelson.
>
>
>
> --
> 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
>



-- 
Kind Regards,
Okello Nelson
+254 722 137 826
cn.okello@gmail.com

Re: Block a Queue until all exchanges are received

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

You can control the other route for example as, eg to start|stop it etc
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Or in Camel 2.11 use the control bus component
http://camel.apache.org/controlbus.html



On Tue, Apr 16, 2013 at 10:49 AM, Okello Nelson <cn...@gmail.com> wrote:
> Hi Guys,
>
> Having a route DSL as:
>
> from("file:" + classesBaseDir + "/" + fileType +
> "/step0?preMove=inprogress&moveFailed=.error&move=.done&readLock=true")
> .routeId(dirRepoPrefix + fileType + "-To-" + queuePrefix + fileType +
> "_ParsingQ")
> .threads(50)
> .split().tokenize("\n", 5).streaming().parallelProcessing()
> .doTry().to(queuePrefix + fileType + "_ParsingQ?asyncConsumer=true")
> .doCatch(Exception.class).to(queuePrefix + fileType + "_InvalidParsingQ");
>
> There's another route that consumes the exchanges of the "...ParsingQ".
> However, I want exchanges at "...ParsingQ" to be consumed only when all the
> files have been loaded into the queue. Is there a way I can implement this?
>
> Thanks a lot in advance.
>
> Kind Regards,
> Okello Nelson.



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