camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Camel crashes upon ActiveMQ shutdown
Date Mon, 05 Mar 2012 09:26:37 GMT
Hi

Can you tell a bit more about the difference in Tomcat, that works,
and the other that does not work.

I assume you deploy a WAR to Tomcat, and have a spring
servlet/listener to pickup and start the app, from the spring XML
file.
And then there is some difference in how you boot up Camel? Or how do
you do that?


On Mon, Mar 5, 2012 at 8:48 AM, ShlomiJ <shlomijava@gmail.com> wrote:
>
> 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.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message