mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4637 - populate DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY for messages that exceed a redelivery policy - makes it easier to identify in the dlq
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1504423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
141052bcf5
commit
a971b648ea
|
@ -1208,6 +1208,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
|
||||||
MessageAck ack = new MessageAck(lastMd, MessageAck.POSION_ACK_TYPE, deliveredMessages.size());
|
MessageAck ack = new MessageAck(lastMd, MessageAck.POSION_ACK_TYPE, deliveredMessages.size());
|
||||||
ack.setPoisonCause(lastMd.getRollbackCause());
|
ack.setPoisonCause(lastMd.getRollbackCause());
|
||||||
ack.setFirstMessageId(firstMsgId);
|
ack.setFirstMessageId(firstMsgId);
|
||||||
|
ack.setPoisonCause(new Throwable("Exceeded redelivery policy limit:" + redeliveryPolicy));
|
||||||
session.sendAck(ack,true);
|
session.sendAck(ack,true);
|
||||||
// Adjust the window size.
|
// Adjust the window size.
|
||||||
additionalWindowSize = Math.max(0, additionalWindowSize - deliveredMessages.size());
|
additionalWindowSize = Math.max(0, additionalWindowSize - deliveredMessages.size());
|
||||||
|
|
|
@ -24,6 +24,7 @@ import javax.jms.TextMessage;
|
||||||
import junit.framework.Test;
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
|
import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
|
||||||
|
import org.apache.activemq.command.ActiveMQMessage;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.command.ActiveMQTopic;
|
import org.apache.activemq.command.ActiveMQTopic;
|
||||||
|
|
||||||
|
@ -199,6 +200,8 @@ public class RedeliveryPolicyTest extends JmsTestSupport {
|
||||||
m = (TextMessage)dlqConsumer.receive(1000);
|
m = (TextMessage)dlqConsumer.receive(1000);
|
||||||
assertNotNull(m);
|
assertNotNull(m);
|
||||||
assertEquals("1st", m.getText());
|
assertEquals("1st", m.getText());
|
||||||
|
String cause = m.getStringProperty(ActiveMQMessage.DLQ_DELIVERY_FAILURE_CAUSE_PROPERTY);
|
||||||
|
assertTrue("cause exception has policy ref", cause.contains("RedeliveryPolicy"));
|
||||||
session.commit();
|
session.commit();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue