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!*
But...
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?

thanks
SJ

--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-crashes-upon-ActiveMQ-shutdown-tp5534910p5536795.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to