You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Tom Howe <to...@artcore.com> on 2011/12/19 15:59:48 UTC

Pausing Routes

Hi,

If we have a route where we are consuming messages and posting to a REST
service which occasionally returns 503 when busy, is there a way to pause
the route for a while so we don't hammer the busy REST service? We also
have other routes in the same Camelcontext that we would not want to pause.
We have tried stopping/starting the route but this seems slow - I suspect
it is starting stopping the underlying thread pools.


Thanks, Tom

Re: Pausing Routes

Posted by bvahdat <ba...@swissonline.ch>.
No, look at [1] for it's complete documentation.

[1] http://camel.apache.org/pojo-consuming.html

Babak

--
View this message in context: http://camel.465427.n5.nabble.com/Pausing-Routes-tp5086372p5089207.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Pausing Routes

Posted by Tom Howe <to...@artcore.com>.
Does @consume not create an underlying route ?



On Tue, Dec 20, 2011 at 3:13 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Dec 20, 2011 at 4:08 PM, Tom Howe <to...@artcore.com> wrote:
> > Hi Claus,
> > Why is graceful shutdown important for suspend/resume?
> >
> > I think this is what I need..
> >   myCamelContext.suspendRoute("routeId");
> >   myCamelContext.resumeRoute("routeId");
> >
>
> Yes use that API
>
> > We are using @consume, is there a way to specify routeId when using
> > @consume? or a way to call suspendRoute from @consume?
> >
>
> No @Consume is for using a bean to consume messages from a camel endpoint.
>
>
> > Thanks, Tom
> >
> >
> >
> >
> > On Tue, Dec 20, 2011 at 2:57 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> On Tue, Dec 20, 2011 at 3:53 PM, Tom Howe <to...@artcore.com> wrote:
> >> > Thanks, is there an example of how to suspend a route?
> >> >
> >>
> >> You can use JMX, for example the examples/camel-example-management
> >>
> >> The API on CamelContext  should have methods to suspend/resume routes.
> >> And this is the API you should use,
> >> as they use the proper logic with graceful shutdown
> >> http://camel.apache.org/graceful-shutdown.html
> >>
> >> And there is a FAQ to stop a route from a route
> >> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
> >>
> >> >
> >> > On Mon, Dec 19, 2011 at 3:52 PM, Claus Ibsen <cl...@gmail.com>
> >> wrote:
> >> >
> >> >> Hi
> >> >>
> >> >> Some routes support suspend/resume.
> >> >>
> >> >> See
> >> >> http://camel.apache.org/lifecycle
> >> >>
> >> >> On Mon, Dec 19, 2011 at 3:59 PM, Tom Howe <to...@artcore.com>
> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > If we have a route where we are consuming messages and posting to a
> >> REST
> >> >> > service which occasionally returns 503 when busy, is there a way to
> >> pause
> >> >> > the route for a while so we don't hammer the busy REST service? We
> >> also
> >> >> > have other routes in the same Camelcontext that we would not want
> to
> >> >> pause.
> >> >> > We have tried stopping/starting the route but this seems slow - I
> >> suspect
> >> >> > it is starting stopping the underlying thread pools.
> >> >> >
> >> >> >
> >> >> > Thanks, Tom
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Claus Ibsen
> >> >> -----------------
> >> >> FuseSource
> >> >> Email: cibsen@fusesource.com
> >> >> Web: http://fusesource.com
> >> >> Twitter: davsclaus, fusenews
> >> >> Blog: http://davsclaus.blogspot.com/
> >> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >> >>
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Pausing Routes

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Dec 20, 2011 at 4:08 PM, Tom Howe <to...@artcore.com> wrote:
> Hi Claus,
> Why is graceful shutdown important for suspend/resume?
>
> I think this is what I need..
>   myCamelContext.suspendRoute("routeId");
>   myCamelContext.resumeRoute("routeId");
>

Yes use that API

> We are using @consume, is there a way to specify routeId when using
> @consume? or a way to call suspendRoute from @consume?
>

No @Consume is for using a bean to consume messages from a camel endpoint.


> Thanks, Tom
>
>
>
>
> On Tue, Dec 20, 2011 at 2:57 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> On Tue, Dec 20, 2011 at 3:53 PM, Tom Howe <to...@artcore.com> wrote:
>> > Thanks, is there an example of how to suspend a route?
>> >
>>
>> You can use JMX, for example the examples/camel-example-management
>>
>> The API on CamelContext  should have methods to suspend/resume routes.
>> And this is the API you should use,
>> as they use the proper logic with graceful shutdown
>> http://camel.apache.org/graceful-shutdown.html
>>
>> And there is a FAQ to stop a route from a route
>> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>>
>> >
>> > On Mon, Dec 19, 2011 at 3:52 PM, Claus Ibsen <cl...@gmail.com>
>> wrote:
>> >
>> >> Hi
>> >>
>> >> Some routes support suspend/resume.
>> >>
>> >> See
>> >> http://camel.apache.org/lifecycle
>> >>
>> >> On Mon, Dec 19, 2011 at 3:59 PM, Tom Howe <to...@artcore.com> wrote:
>> >> > Hi,
>> >> >
>> >> > If we have a route where we are consuming messages and posting to a
>> REST
>> >> > service which occasionally returns 503 when busy, is there a way to
>> pause
>> >> > the route for a while so we don't hammer the busy REST service? We
>> also
>> >> > have other routes in the same Camelcontext that we would not want to
>> >> pause.
>> >> > We have tried stopping/starting the route but this seems slow - I
>> suspect
>> >> > it is starting stopping the underlying thread pools.
>> >> >
>> >> >
>> >> > Thanks, Tom
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> FuseSource
>> >> Email: cibsen@fusesource.com
>> >> Web: http://fusesource.com
>> >> Twitter: davsclaus, fusenews
>> >> Blog: http://davsclaus.blogspot.com/
>> >> Author of Camel in Action: http://www.manning.com/ibsen/
>> >>
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Pausing Routes

Posted by Tom Howe <to...@artcore.com>.
Hi Claus,
Why is graceful shutdown important for suspend/resume?

I think this is what I need..
   myCamelContext.suspendRoute("routeId");
   myCamelContext.resumeRoute("routeId");

We are using @consume, is there a way to specify routeId when using
@consume? or a way to call suspendRoute from @consume?

Thanks, Tom




On Tue, Dec 20, 2011 at 2:57 PM, Claus Ibsen <cl...@gmail.com> wrote:

> On Tue, Dec 20, 2011 at 3:53 PM, Tom Howe <to...@artcore.com> wrote:
> > Thanks, is there an example of how to suspend a route?
> >
>
> You can use JMX, for example the examples/camel-example-management
>
> The API on CamelContext  should have methods to suspend/resume routes.
> And this is the API you should use,
> as they use the proper logic with graceful shutdown
> http://camel.apache.org/graceful-shutdown.html
>
> And there is a FAQ to stop a route from a route
> http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html
>
> >
> > On Mon, Dec 19, 2011 at 3:52 PM, Claus Ibsen <cl...@gmail.com>
> wrote:
> >
> >> Hi
> >>
> >> Some routes support suspend/resume.
> >>
> >> See
> >> http://camel.apache.org/lifecycle
> >>
> >> On Mon, Dec 19, 2011 at 3:59 PM, Tom Howe <to...@artcore.com> wrote:
> >> > Hi,
> >> >
> >> > If we have a route where we are consuming messages and posting to a
> REST
> >> > service which occasionally returns 503 when busy, is there a way to
> pause
> >> > the route for a while so we don't hammer the busy REST service? We
> also
> >> > have other routes in the same Camelcontext that we would not want to
> >> pause.
> >> > We have tried stopping/starting the route but this seems slow - I
> suspect
> >> > it is starting stopping the underlying thread pools.
> >> >
> >> >
> >> > Thanks, Tom
> >>
> >>
> >>
> >> --
> >> Claus Ibsen
> >> -----------------
> >> FuseSource
> >> Email: cibsen@fusesource.com
> >> Web: http://fusesource.com
> >> Twitter: davsclaus, fusenews
> >> Blog: http://davsclaus.blogspot.com/
> >> Author of Camel in Action: http://www.manning.com/ibsen/
> >>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Pausing Routes

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Dec 20, 2011 at 3:53 PM, Tom Howe <to...@artcore.com> wrote:
> Thanks, is there an example of how to suspend a route?
>

You can use JMX, for example the examples/camel-example-management

The API on CamelContext  should have methods to suspend/resume routes.
And this is the API you should use,
as they use the proper logic with graceful shutdown
http://camel.apache.org/graceful-shutdown.html

And there is a FAQ to stop a route from a route
http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

>
> On Mon, Dec 19, 2011 at 3:52 PM, Claus Ibsen <cl...@gmail.com> wrote:
>
>> Hi
>>
>> Some routes support suspend/resume.
>>
>> See
>> http://camel.apache.org/lifecycle
>>
>> On Mon, Dec 19, 2011 at 3:59 PM, Tom Howe <to...@artcore.com> wrote:
>> > Hi,
>> >
>> > If we have a route where we are consuming messages and posting to a REST
>> > service which occasionally returns 503 when busy, is there a way to pause
>> > the route for a while so we don't hammer the busy REST service? We also
>> > have other routes in the same Camelcontext that we would not want to
>> pause.
>> > We have tried stopping/starting the route but this seems slow - I suspect
>> > it is starting stopping the underlying thread pools.
>> >
>> >
>> > Thanks, Tom
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> FuseSource
>> Email: cibsen@fusesource.com
>> Web: http://fusesource.com
>> Twitter: davsclaus, fusenews
>> Blog: http://davsclaus.blogspot.com/
>> Author of Camel in Action: http://www.manning.com/ibsen/
>>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: Pausing Routes

Posted by Tom Howe <to...@artcore.com>.
Thanks, is there an example of how to suspend a route?


On Mon, Dec 19, 2011 at 3:52 PM, Claus Ibsen <cl...@gmail.com> wrote:

> Hi
>
> Some routes support suspend/resume.
>
> See
> http://camel.apache.org/lifecycle
>
> On Mon, Dec 19, 2011 at 3:59 PM, Tom Howe <to...@artcore.com> wrote:
> > Hi,
> >
> > If we have a route where we are consuming messages and posting to a REST
> > service which occasionally returns 503 when busy, is there a way to pause
> > the route for a while so we don't hammer the busy REST service? We also
> > have other routes in the same Camelcontext that we would not want to
> pause.
> > We have tried stopping/starting the route but this seems slow - I suspect
> > it is starting stopping the underlying thread pools.
> >
> >
> > Thanks, Tom
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>

Re: Pausing Routes

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

Some routes support suspend/resume.

See
http://camel.apache.org/lifecycle

On Mon, Dec 19, 2011 at 3:59 PM, Tom Howe <to...@artcore.com> wrote:
> Hi,
>
> If we have a route where we are consuming messages and posting to a REST
> service which occasionally returns 503 when busy, is there a way to pause
> the route for a while so we don't hammer the busy REST service? We also
> have other routes in the same Camelcontext that we would not want to pause.
> We have tried stopping/starting the route but this seems slow - I suspect
> it is starting stopping the underlying thread pools.
>
>
> Thanks, Tom



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/