You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Jeff Segal <je...@gmail.com> on 2011/10/04 17:11:43 UTC

Custom behavior on route shutdown

I have an application which dynamically creates and removes routes in
a camel context. I'd like to be able to invoke an onShutdown method
when routes are removed so that I can perform some cleanup tasks. I've
read http://camel.apache.org/graceful-shutdown.html but wasn't able to
find a good solution there. Ideally I'd define a Runnable and
configure it like this:

from("foo:bar").to("abc:123").onShutdown(myRunnable);

Is there some alternative that I missed or is this more of a feature request?

Thanks,
Jeff

Re: Custom behavior on route shutdown

Posted by Jeff Segal <je...@gmail.com>.
Thanks Claus. I created
https://issues.apache.org/jira/browse/CAMEL-4514 for this issue. I
took your advice and suggested adding the callback to RoutePolicy,
especially since it already has an onInit(Route) method.

On Tue, Oct 4, 2011 at 11:51 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Tue, Oct 4, 2011 at 5:11 PM, Jeff Segal <je...@gmail.com> wrote:
>> I have an application which dynamically creates and removes routes in
>> a camel context. I'd like to be able to invoke an onShutdown method
>> when routes are removed so that I can perform some cleanup tasks. I've
>> read http://camel.apache.org/graceful-shutdown.html but wasn't able to
>> find a good solution there. Ideally I'd define a Runnable and
>> configure it like this:
>>
>> from("foo:bar").to("abc:123").onShutdown(myRunnable);
>>
>> Is there some alternative that I missed or is this more of a feature request?
>>
>
> There is no such thing in the DSL.
>
> Would could possible look into adding support for callbacks on
> RoutePolicy, as you
> could then associate a route with a policy, and have callbacks for
> onStart / onStop / onShutdown wtc.
>
> Fell free to create a JIRA ticket.
>
>
>> Thanks,
>> Jeff
>>
>
>
>
> --
> 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: Custom behavior on route shutdown

Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Oct 4, 2011 at 5:11 PM, Jeff Segal <je...@gmail.com> wrote:
> I have an application which dynamically creates and removes routes in
> a camel context. I'd like to be able to invoke an onShutdown method
> when routes are removed so that I can perform some cleanup tasks. I've
> read http://camel.apache.org/graceful-shutdown.html but wasn't able to
> find a good solution there. Ideally I'd define a Runnable and
> configure it like this:
>
> from("foo:bar").to("abc:123").onShutdown(myRunnable);
>
> Is there some alternative that I missed or is this more of a feature request?
>

There is no such thing in the DSL.

Would could possible look into adding support for callbacks on
RoutePolicy, as you
could then associate a route with a policy, and have callbacks for
onStart / onStop / onShutdown wtc.

Fell free to create a JIRA ticket.


> Thanks,
> Jeff
>



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