activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kaipa <>
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

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"
     <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 id="listenerContainer"
        <property name="concurrentConsumers" value="1" />
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="destination" ref="destination" />
        <property name="messageListener" ref="messageListener" />

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

Thank you in advance.
View this message in context:
Sent from the ActiveMQ - User forum at

View raw message