activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kaipa <alex.zait...@mtu-net.ru>
Subject Redelivery of failed messages
Date Fri, 15 Sep 2006 09:38:48 GMT

Hi all,

We are implementing a fail-over scenario for message processing in the
queue. We may have one to many message producers and one to many phisically
separated servers that consume messages from the queue. It is possible that
one consuming server fails for some reason and we need to redeliver message
to the different server in this case. Here is the sequence we want to
implement:

1. Message is posted to the queue
2. Message is consumed by server1
3. Server1 one fails to process the message for some reason. 
4. Message is re-delivered to server2.

Note, server1 does not brake the connection, it just can't process one
particular message.

We use AMQ 4.0.1 with Spring 2.0 and consume message with Spring listener.
Here is the typical configuration:

  <bean id="connectionFactory"
      class="org.apache.activemq.ActiveMQConnectionFactory">
     <property name="brokerURL" value="tcp://qservice:61616" />
     <property name="redeliveryPolicy">
     	  <bean class="org.apache.activemq.RedeliveryPolicy">
	  	  		<property name = "initialRedeliveryDelay" value="60000"/>
			 	<property name = "backOffMultiplier" value="2"/>
				<property name = "useExponentialBackOff" value="true"/>
				<property name = "maximumRedeliveries" value="3"/>
  		  </bean>     	
     </property>
   </bean>

    <bean id="listenerContainer"
     
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="concurrentConsumers" value="1" />
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="destination" ref="destination" />
        <property name="messageListener" ref="messageListener" />
    </bean>

MessageListener throws an exception in onMessage() if it can't process the
message. However, we can not make re-delivery to work. It is not being
re-delivered yet to the same server!

Could you help us to understand:
1. What is wrong in our case?
2. How to implement re-delivery as desired.
3. I've tried some tests, and re-delivery works if transactional session is
used and rollback() called. But how to make it working with message
listeners?

Thank you in advance.
-- 
View this message in context: http://www.nabble.com/Redelivery-of-failed-messages-tf2276524.html#a6322201
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message