camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pmp.martins" <pmp.mart...@campus.fct.unl.pt>
Subject Is there a way to send a message when I am terminating?
Date Fri, 08 Nov 2013 11:20:06 GMT
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.

Mime
View raw message