Announcement Announcement Module
No announcement yet.
MessageListner is not invoking as per RedeliveryPolicy. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • MessageListner is not invoking as per RedeliveryPolicy.

    Hi All,
    I have configured MessageListner to consume messages from activeMQ queue with spring integration components. If any exception occured in onMessage method that message has to redeliver based on redelivery policy.
    But in my case it is not working as expected.

    My configurations are::

    <bean id="amqConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFac tory">
    <property name="brokerURL" value="${BROKER_URL}"/>
    <property name="redeliveryPolicy" ref="redeliveryPolicy" />
    <property name="prefetchPolicy" ref="queuePrefetchPolicy"/>

    <bean id = "redeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">
    <property name="maximumRedeliveries" value="3"/>
    <property name="useExponentialBackOff" value="false" />
    <property name="initialRedeliveryDelay" value="1000" />

    <bean id="queuePrefetchPolicy" class="org.apache.activemq.ActiveMQPrefetchPolicy" >
    <property name="queuePrefetch" value="2"/>

    bean id="transactionManager" class="org.springframework.jms.connection.JmsTrans actionManager">
    <property name="connectionFactory" ref="connectionFactory" />

    <bean id="messageListenerContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
    <property name="connectionFactory" ref="amqConnectionFactory"/>
    <property name="transactionManager" ref="transactionManager"/>
    <property name="destination" ref="requestQueue"/>
    <property name="sessionTransacted" value="true"/>
    <property name="maxConcurrentConsumers" value="5"/>
    <property name="concurrentConsumers" value="1"/>
    <property name="receiveTimeout" value="5000"/>
    <property name="recoveryInterval" value="60000"/>
    <property name="autoStartup" value="true"/>
    <property name="messageListener" ref="messageConsumer" />
    <!-- WARNING!! This is required to get redelivery to work on message exception/rollback -->
    <property name="cacheLevelName" value="CACHE_CONSUMER"/>

    <bean id="messageConsumer" class="test.MyMessageProcessorSimple"/>

    And MyMessageProcessorSimple is,
    public class MyMessageProcessorSimple implements MessageListener {
    public void onMessage(Message msg) {
    throw new RuntimeException("Failed now - ");

    Even though after configuring redeliverypolicy and throwing RuntimeException in onMessage method, Still my message is delivering only once and it is not moving to DLQ.

    Can some one help please.

    Thanks in Advance
    Mohan Reddy M

  • #2
    There still seem to be a problem in ActiveMQ (?)