activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Lewandowski <a...@alewando.com>
Subject Redelivery policy not honored
Date Tue, 10 Jul 2007 20:09:17 GMT
At what level does the redelivery policy get applied? I've got a 
transactional consumer (Spring MDP) that is performing a rollback and I 
am expecting the message to be redelivered a maximum number of times as 
specified on the connection factory's redelivery policy. After the 
maximum retry attempts, I'm expecting to see the message sent to the 
dead letter queue as specified in the broker's destination policy map.
Instead, the message gets delivered over and over again, with an 
increasing value for the JMSXDeliveryCount message property and never 
gets placed on the dead letter queue. It looks as if the redelivery 
policy isn't being honored.
The only place I could find in the code where the redelivery policy is 
applied is at the MessageConsumer level (ActiveMQMessageConsumer). This 
doesn't make sense to me since a different consumers could get the 
message on repeated delivery attempts, correct? Spring's message 
listener framework seems to confirm this as it uses a polling model, 
creating a new MessageConsumer and Session once per second 
(AbstractPollingMessageListenerContainer). Does AMQ expect that the same 
MessageConsumer will be used for message redelivery in a transactional 
setting?

Configuration:
Connection Factory:
    <bean id="jmsConnectionFactory"
        class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="vm://broker" />
        <property name="redeliveryPolicy">
            <bean class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="2" />
            </bean>
        </property>
    </bean>

Broker:
    <broker brokerName="broker" persistent="true" useJmx="false"
        start="true" xmlns="http://activemq.org/config/1.0">
        <destinationPolicy>
            <policyMap>
                 <policyEntries>
                     <policyEntry queue="EventQueue">
                        <deadLetterStrategy>
                            <individualDeadLetterStrategy 
queuePrefix="DEAD" />
                        </deadLetterStrategy>
                     </policyEntry>
                 </policyEntries>               
            </policyMap>
        </destinationPolicy>
        <transportConnectors>
            <transportConnector uri="vm://broker" />
        </transportConnectors>
    </broker>


Mime
View raw message