camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henrique Viecili <henri...@myreks.com>
Subject Re: How to execute route on shutdown?
Date Thu, 18 Oct 2012 13:35:56 GMT
Claus,

what I am doing is a Dynamic Recipient List where I must register these
'services', when a service is started it sends its routing configuration to
the DRL and when it's shut down it tells the DRL the service is offline. I
believe the most appropriate is the shutdown from the CamelContext.

I was looking for something like:

<route id="service-shutdown-route" autoStartup="false" *onShutdown="true"* >
  <from uri="timer:runOnce?delay=0&amp;repeatCount=1" />
  ...
  <to uri="jms:DRLControlChannel" />
</route>


*Henrique Viecili*


On Thu, Oct 18, 2012 at 12:56 AM, Claus Ibsen <claus.ibsen@gmail.com> wrote:

> On Mon, Oct 15, 2012 at 11:27 PM, Henrique Viecili <henrique@myreks.com>
> wrote:
> > Hello guys...
> >
> > I've created a service that register itself on startup using camel-timer
> > component and now I want to make it unregister itself on shutdown. I
> know I
> > could do it registering a Shutdown Hook in the JVM or coding my own
> > ShutdownStrategy but I am looking for a simple solution preferably using
> > Spring DSL. Does anyone have done this before?
> >
> > Thanks,
> > *Henrique Viecili*
>
> What is your "service". And what do you mean by unreigstering itself
> on shutdown?
> From what should it unregister, and when you say shutdown, it is the
> CamelContext being stopped or the JVM itself etc.?
>
> And with Spring you can simple just do
> <bean id="foo" class="xxx" init-method="startMe" destroy-method="killMe"/>
>
> The names of the attributes, you would need to check the spring docs
> to make sure, as I am not sure if init-method etc is the correct name.
>
>
> --
> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message