[rabbitmq-discuss] Retry Message for 3 times with 10 seconds interval - in Consumer

Srinath Sridharan -X (srinatsr - ZENSAR TECHNOLOGIES INC at Cisco) srinatsr at cisco.com
Tue May 20 20:09:21 BST 2014


Hello,

I am consuming the messages using the listener as follows,  I need to retry processing three times if any exceptions occurred.

<bean
        class="org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer">
        <property name="connectionFactory" ref="connectionFactory" />
        <property name="queueNames">
            <array>
                <value>validateRequestQueue</value>
            </array>
        </property>
        <property name="messageListener">
            <bean
                class="org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter">
                <property name="delegate" ref="retryConsumer" />
            </bean>
        </property>
        <!-- <property name="acknowledgeMode" value="NONE" /> -->
    </bean>


public class RetryConsumer implements ChannelAwareMessageListener {

       /**
       * Callback for processing a received Rabbit message.
       * @param message the received AMQP message
       * @param channel the underlying Rabbit Channel
       * @throws Exception
        */
       @Override
       public void onMessage(Message message, Channel channel) throws Exception {

             System.out.println("Received Message :: "+new String(message.getBody()));
             if(true){
             throw new RuntimeException("Error");
             }

       }

Regards ...*
Srinath

From: Srinath Sridharan -X (srinatsr - ZENSAR TECHNOLOGIES INC at Cisco)
Sent: Monday, May 19, 2014 10:47 AM
To: rabbitmq-discuss at lists.rabbitmq.com
Subject: Retry Message for 3 times with 10 seconds interval - in Consumer



Retry unacknowledged RabbitMQ message in 10 second interval

And Retry 3 times using Spring framework in java .



Please need help on this

Regards ...*
Srinath

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140520/f8caa816/attachment.html>


More information about the rabbitmq-discuss mailing list