You can use event notifier to get callbacks when Camel is shutting down and many other events.
Some details here http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html But I think the Main class you use has methods as well you can override for start|stop events. Check that first, that would be easier to use. On Fri, Nov 8, 2013 at 12:20 PM, pmp.martins <[email protected]> wrote: > Hello all, I have a simply camel MINA server using the JAVA DSL, and I am > running like the example documented here: > http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html > http://camel.apache.org/mina2.html > > Currently this server receives reports from a queue, updates them, and then > sends them away to the next server. A very simple code: > > > public class MyApp_B { > > private Main main; > > public static void main(String... args) throws Exception { > MyApp_B loadbalancer = new MyApp_B(); > loadbalancer.boot(); > } > > public void boot() throws Exception { > main = new Main(); > main.enableHangupSupport(); > > main.addRouteBuilder( > new RouteBuilder(){ > @Override > public void configure() throws > Exception { > > from("mina:tcp://localhost:9991") > .setHeader("minaServer", > constant("localhost:9991")) > .beanRef("service.Reporting", > "updateReport") > .to("direct:messageSender1"); > > from("direct:messageSender1") > > .to("mina:tcp://localhost:9993") > .log("${body}"); > } > } > ); > > System.out.println("Starting Camel MyApp_B. Use ctrl + c to > terminate the > JVM.\n"); > main.run(); > } > } > > > Now, I would like to know if it is possible to do two things: > 1 - Make this server send a message to a master server when it starts > running. This is an "Hello" message with this server's information > basically. > 2 - Tell the master server to forget him when I shut it down pressing CTRL+C > or doing something else. > > Is there a way to do this ? If yes how? If not, what are my options? > > Thanks in advance, Pedro. > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Is-there-a-way-to-send-a-message-when-I-am-terminating-tp5742834.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- Red Hat, Inc. Email: [email protected] Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
