camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: Camel crashes upon ActiveMQ shutdown
Date Sun, 04 Mar 2012 10:23:29 GMT
As far as I know the failover transport makes a route seem to "hang" if 
no server is available as the connect call waits till a broker is 
available again.
Typically this should only halt the route and not the whole process.

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.

Christian

Am 04.03.2012 08:34, schrieb shlomi java:
> hi all,
>
> I have a simple* [from:activemq:queue:queueName - to:log]* route, in Camel
> 2.9.0 context, with ActiveMQ 5.5.1.
>
> *When ActiveMQ gets shutdown (like on restart), the entire Camel
> application is shut down also.*
> *I would like the Camel application to be kept alive, waiting for an
> available broker service. *(Is it not a reasonable wish?)
>
> I'm using failover on top of a single TCP transport, with
> maxReconnectAttempts=-1 and initialReconnectDelay=10000 (these properties
> goes on the failover, not on the tcp transport), to get my ActiveMQ
> Connection Factory, with a PooledConnectionFactory on top of that.
> The Camel context runs with org.apache.camel.spring.Main.
>
> I tried adding my own TransportListener on the ActiveMQConnectionFactory,
> but could not come with an insight.
>
> *Configuration:*
> <bean id="jmsConnectionFactory"
> class="org.apache.activemq.ActiveMQConnectionFactory">
>      <property name="brokerURL"
> value="failover:(tcp://localhost:61616)?maxReconnectAttempts=-1&initialReconnectDelay=10000"
> />
>      <property name="transportListener">
>          <bean class="controller.MyTransportListener" />
>      </property>
> </bean>
>
> *Log:*
> 2012-03-01 15:04:26.068 DEBUG tcp.TcpTransport - Stopping transport
> tcp://localhost/127.0.0.1:61616
> 2012-03-01 15:04:26.072 WARN  failover.FailoverTransport - Transport
> (localhost/127.0.0.1:61616) failed to tcp://localhost:61616 , attempting to
> automatically reconnect due to: java.io.EOFException
> 2012-03-01 15:04:26.081 DEBUG failover.FailoverTransport - Transport failed
> with the following exception:
> java.io.EOFException
> at java.io.DataInputStream.readInt(Unknown Source)
> at
> org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269)
> at
> org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:227)
> at
> org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:219)
> at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:202)
> at java.lang.Thread.run(Unknown Source)
> 2012-03-01 15:04:26.087 DEBUG activemq.ActiveMQConnection - transport
> interrupted, dispatchers: 20
> 2012-03-01 15:04:26.087 DEBUG activemq.ActiveMQConnection - notified
> failover transport (unconnected) of pending interruption processing for:
> ID:-13681-1330606750154-0:1
> 2012-03-01 15:04:26.088 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:10:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.089 ERROR controller.MyTransportListener - Interupted
> 2012-03-01 15:04:26.089 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:5:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.089 DEBUG failover.FailoverTransport - urlList
> connectionList:[tcp://localhost:61616], from: [tcp://localhost:61616]
> 2012-03-01 15:04:26.089 DEBUG failover.FailoverTransport - Attempting
> connect to: tcp://localhost:61616
> 2012-03-01 15:04:26.089 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:8:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:20:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:12:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:4:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:3:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:18:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:9:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:7:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:11:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:15:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:14:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:16:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.090 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:1:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.091 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:17:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.091 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:13:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.091 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:2:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.091 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:6:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.091 DEBUG activemq.ActiveMQMessageConsumer -
> ID:-13681-1330606750154-0:1:19:1 clearing dispatched list (0) on transport
> interrupt
> 2012-03-01 15:04:26.091 DEBUG activemq.ActiveMQConnection -
> transportInterruptionProcessingComplete for: ID:-13681-1330606750154-0:1
>
>
> 10x for any input.
> ShlomiJ
>


-- 

Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com


Mime
View raw message