its one thing if you cannot deliver, its another thing when you deliver but you get an exception. http://activemq.apache.org/message-redelivery-and-dlq-handling.html
i think default poison pill value is 6? not sure on this.
题
I'm using apacheMQ as queue manager. I'm using Spring's DefaultMessageListenerContainer to consume the messages. I've configured it so it has a transaction:
<bean id="jmsContainerXXX" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="connectionFactory" ref="myConnectionFactory"/>
<property name="destination" ref="myDestination"/>
<property name="messageListener" ref="myMessageListener" />
<property name="concurrentConsumers" value="5"/>
<property name="sessionTransacted" value="true" />
</bean>
I've configured ApacheMQ to have a specific redelivery policy, so if a message is not successfully processed, it gets redelivered after 1min, 5min, 25min, etc:
<redeliveryPlugin fallbackToDeadLetter="true" sendToDlqIfMaxRetriesExceeded="true">
<redeliveryPolicyMap>
<redeliveryPolicyMap>
<!-- the fallback policy for all destinations -->
<defaultEntry>
<redeliveryPolicy maximumRedeliveries="10"
maximumRedeliveryDelay="14400000"
redeliveryDelay="60000"
initialRedeliveryDelay="60000"
useExponentialBackOff="true"
backOffMultiplier="5"/>
</defaultEntry>
</redeliveryPolicyMap>
</redeliveryPolicyMap>
</redeliveryPlugin>
Finally, in the message listener I placed a bold 'throw new RuntimeException("poum");' to be sure that the delivery fails.
And this is the result I get: - At first, ActiveMQ is delivering me the message 6 times, then it waits. - After 1 minute, ActiveMQ delivers the message 6 more times, then it waits. - After 5 minutes, ActiveMQ delivers the message 6 more times, then it waits. - etc.
My question is: why ActiveMQ delivers the message 6 times before rescheduling?
解决方案
its one thing if you cannot deliver, its another thing when you deliver but you get an exception. http://activemq.apache.org/message-redelivery-and-dlq-handling.html
i think default poison pill value is 6? not sure on this.