Announcement Announcement Module
Collapse
No announcement yet.
Problem with reconnect (recover) after network failure Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with reconnect (recover) after network failure

    Hi,

    I've a problem with the automatic reconnect after a network failure when I use the DefaultMessageListenerContainer with the "sessionTransacted" property set to "true".
    It seems that if the network goes down while the AbstractMessageListenerContainer.doExecuteListener ()-method (called by DefaultMessageListenerContainer.invokeListener() ) and tries to commit the session (a JMSException is thrown caused by SocketException: Connection reset) the listener is stopped and no longer reconnected if the "concurrentConsumers" are set to "1".
    Code:
    03 Sep 2007 17:15:38.937 [WARN][listenerContainer-1] [org.springframework.jms.listener.DefaultMessageListenerContainer] - Execution of JMS message listener failed
    javax.jms.JMSException: Connection reset
    	at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:49)
    	at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1174)
    	at org.apache.activemq.TransactionContext.commit(TransactionContext.java:259)
    	at org.apache.activemq.ActiveMQSession.commit(ActiveMQSession.java:535)
    	at org.springframework.jms.support.JmsUtils.commitIfNecessary(JmsUtils.java:184)
    	at org.springframework.jms.listener.AbstractMessageListenerContainer.commitIfNecessary(AbstractMessageListenerContainer.java:525)
    	at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:428)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:309)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:871)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:811)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.net.SocketException: Connection reset
    	at java.net.SocketInputStream.read(Unknown Source)
    	at org.apache.activemq.transport.tcp.TcpBufferedInputStream.fill(TcpBufferedInputStream.java:50)
    	at org.apache.activemq.transport.tcp.TcpBufferedInputStream.read(TcpBufferedInputStream.java:58)
    	at java.io.DataInputStream.readInt(Unknown Source)
    	at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:268)
    	at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:196)
    	at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:188)
    	at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:176)
    	... 1 more
    The reconnect works perfect if the network goes down while the listener is in AbstractPollingMessageListenerContainer.receiveMes sage().
    Code:
    03 Sep 2007 17:35:49.071 [ERROR][listenerContainer-1] [org.springframework.jms.listener.DefaultMessageListenerContainer] - Setup of JMS message listener invoker failed - trying to recover
    javax.jms.IllegalStateException: The Consumer is closed
    	at org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:667)
    	at org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:497)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveMessage(AbstractPollingMessageListenerContainer.java:375)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:300)
    	at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:254)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:871)
    	at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:811)
    	at java.lang.Thread.run(Unknown Source)
    I'm using Spring 2.0.6 with AMQ-5.0.

    The problem can be reproduced if the producer/broker is running on host A and the consumer that is receiving messages form the topic is on host B and you disconnect the network cable. In my case the producer was sending a message every 200msec.

    Has anybody a solution for this problem or a workaround?
    Thanks in advance.
    Andreas
Working...
X