On Thu, Oct 18, 2012 at 3:35 PM, Henrique Viecili <henri...@myreks.com> wrote: > 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&repeatCount=1" /> > ... > <to uri="jms:DRLControlChannel" /> > </route> >
And how should Camel be able to run this route when its being told to shutdown itself? With the <bean> you can use the depends-on="myCamel" attribute and refer to the <camelContext id="myCamel" ...">. Which will tell Spring to invoke destroy on the <bean> before Camel. Then you got your shutdown signal. >From the bean you can send a message to a route, or an endpoint or whatever you want. > > *Henrique Viecili* > > > On Thu, Oct 18, 2012 at 12:56 AM, Claus Ibsen <claus.ib...@gmail.com> wrote: > >> On Mon, Oct 15, 2012 at 11:27 PM, Henrique Viecili <henri...@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: cib...@redhat.com >> Web: http://fusesource.com >> Twitter: davsclaus >> Blog: http://davsclaus.com >> Author of Camel in Action: http://www.manning.com/ibsen >> -- Claus Ibsen ----------------- Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen