camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ShlomiJ <>
Subject Re: Camel crashes upon ActiveMQ shutdown
Date Mon, 05 Mar 2012 07:48:54 GMT

Claus Ibsen-2 wrote
> Is Camel embedded in the same JVM as the ActiveMQ
The broker service is not embedded in the same JVM.

Christian Schneider wrote
> You could try to set maxReconnectAttempts to e.g. 2. Then activemq will 
> try two times and then return to camel. Camel will then also try to 
> reconnect but it prevents a hang.
The maxReconnectAttempts=2 thing did not work.

I tried moving to *Java syntax*, so instead of using
org.apache.camel.spring.Main with camel-context.xml in my main class, I used
a Thread with a Runnable having the following /run/ method:

/CamelContext context = new DefaultCamelContext();
> String brokerUri =
> "failover:(tcp://localhost:61616)?maxReconnectAttempts=-1&initialReconnectDelay=10000";
> ConnectionFactory connectionFactory = new
> ActiveMQConnectionFactory(brokerUri);
> context.addComponent("jms",
> JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
> try {
> 	context.addRoutes(new RouteBuilder() {
> 		@Override
> 		public void configure() throws Exception
> 		{
> 			from("jms:queueName")
> 			.log("${body}");
> 		}
> 	});
> 	context.start();
> } catch (Exception e) {
> 	e.printStackTrace();
> }/
*Still the same behavior!*
I used the exact code for camel in Tomcat, holding the Camel context with a
singleton initialized upon startup.
*Vuala!* the same scenario of restarting ActiveMQ does not cause Camel to
crash; connection is established once the broker is up again; messages are
consumed and logged.

Any clue for the source of this difference?


View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message