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/05/30 15:48:24 UTC

ActiveMQ Component: Stop route when no more messages are being received

Hi Guys,

I'm wondering how to stop an ActiveMQ route and start another one when it's
nolonger receiving exchanges.

I'm thinking that I probably need to use timeouts, but I'm not sure how to
proceed. I've done some research but no success so far. Anyone with a
solution, please assist.

Kind Regards,
Okello Nelson.

Re: ActiveMQ Component: Stop route when no more messages are being received

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

But the exchange.getContext().getInflightRepository.size(routeName) gives
me some unpredictable stats. May be I haven't understood it well.

The workaround I used is: I wrote a custom stats collector which I wire in
the routes of interest. I then just query the variable containing the stats
to get count of messages processed so far by the route.

Kind Regards,
Okello Nelson.


On Tue, Jun 4, 2013 at 12:17 PM, Claus Ibsen <cl...@gmail.com> wrote:

> You can use the inflight repository to know how many in-flight
> messages a route has.
>
> http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InflightRepository.html
>
> On Mon, Jun 3, 2013 at 4:24 PM, Okello Nelson <cn...@gmail.com> wrote:
> > Hi Guys,
> >
> > I've been trying to work on this. Time has been hard to come by though.
> > Having thought hard about a potential solution, i think using timer
> > component would be the way to go. When period on the timer elpases, i
> > retrieve the number of exchanges at the endpoints of interest.
> >
> > A timer route like:
> >
> >
> from("timer://controller?fixedRate=true&period=5000").to("ref:routesManager")
> >
> > I retrieve exchanges count in the  "routesManager" bean. Now, my problem
> is
> > that i still don't know how to retrieve the count of exchanges at an
> > endpoint. Any assistance here will be appreciated very much.
> >
> > BTW: I've also posted this question at stackoverflow.com (
> > stackoverflow.com/questions/16898646/exchanges-count-at-camel-endpoint).
> > On May 30, 2013 4:48 PM, "Okello Nelson" <cn...@gmail.com> wrote:
> >
> >> Hi Guys,
> >>
> >> I'm wondering how to stop an ActiveMQ route and start another one when
> >> it's nolonger receiving exchanges.
> >>
> >> I'm thinking that I probably need to use timeouts, but I'm not sure how
> to
> >> proceed. I've done some research but no success so far. Anyone with a
> >> solution, please assist.
> >>
> >> Kind Regards,
> >> Okello Nelson.
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> www.camelone.org: The open source integration conference.
>
> 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: ActiveMQ Component: Stop route when no more messages are being received

Posted by Claus Ibsen <cl...@gmail.com>.
You can use the inflight repository to know how many in-flight
messages a route has.
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InflightRepository.html

On Mon, Jun 3, 2013 at 4:24 PM, Okello Nelson <cn...@gmail.com> wrote:
> Hi Guys,
>
> I've been trying to work on this. Time has been hard to come by though.
> Having thought hard about a potential solution, i think using timer
> component would be the way to go. When period on the timer elpases, i
> retrieve the number of exchanges at the endpoints of interest.
>
> A timer route like:
>
> from("timer://controller?fixedRate=true&period=5000").to("ref:routesManager")
>
> I retrieve exchanges count in the  "routesManager" bean. Now, my problem is
> that i still don't know how to retrieve the count of exchanges at an
> endpoint. Any assistance here will be appreciated very much.
>
> BTW: I've also posted this question at stackoverflow.com (
> stackoverflow.com/questions/16898646/exchanges-count-at-camel-endpoint).
> On May 30, 2013 4:48 PM, "Okello Nelson" <cn...@gmail.com> wrote:
>
>> Hi Guys,
>>
>> I'm wondering how to stop an ActiveMQ route and start another one when
>> it's nolonger receiving exchanges.
>>
>> I'm thinking that I probably need to use timeouts, but I'm not sure how to
>> proceed. I've done some research but no success so far. Anyone with a
>> solution, please assist.
>>
>> Kind Regards,
>> Okello Nelson.
>>



-- 
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.

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

Re:ActiveMQ Component: Stop route when no more messages are being received

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

I've been trying to work on this. Time has been hard to come by though.
Having thought hard about a potential solution, i think using timer
component would be the way to go. When period on the timer elpases, i
retrieve the number of exchanges at the endpoints of interest.

A timer route like:

from("timer://controller?fixedRate=true&period=5000").to("ref:routesManager")

I retrieve exchanges count in the  "routesManager" bean. Now, my problem is
that i still don't know how to retrieve the count of exchanges at an
endpoint. Any assistance here will be appreciated very much.

BTW: I've also posted this question at stackoverflow.com (
stackoverflow.com/questions/16898646/exchanges-count-at-camel-endpoint).
On May 30, 2013 4:48 PM, "Okello Nelson" <cn...@gmail.com> wrote:

> Hi Guys,
>
> I'm wondering how to stop an ActiveMQ route and start another one when
> it's nolonger receiving exchanges.
>
> I'm thinking that I probably need to use timeouts, but I'm not sure how to
> proceed. I've done some research but no success so far. Anyone with a
> solution, please assist.
>
> Kind Regards,
> Okello Nelson.
>