part of the fix for AMQ-286 to allow the redelivery policy to be configured on a consumer

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@366170 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-01-05 12:21:24 +00:00
parent 1eaf1f7274
commit f0454b1e88
1 changed files with 14 additions and 1 deletions

View File

@ -110,6 +110,8 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
private MessageAvailableListener availableListener;
private RedeliveryPolicy redeliveryPolicy;
/**
* Create a MessageConsumer
*
@ -151,6 +153,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
this.session = session;
this.selector = selector;
this.redeliveryPolicy = session.connection.getRedeliveryPolicy();
this.info = new ConsumerInfo(consumerId);
this.info.setSubcriptionName(name);
@ -196,6 +199,17 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
return stats;
}
public RedeliveryPolicy getRedeliveryPolicy() {
return redeliveryPolicy;
}
/**
* Sets the redelivery policy used when messages are redelivered
*/
public void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy) {
this.redeliveryPolicy = redeliveryPolicy;
}
/**
* @return Returns the consumerId.
*/
@ -637,7 +651,6 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
return;
rollbackCounter++;
RedeliveryPolicy redeliveryPolicy = session.connection.getRedeliveryPolicy();
if (rollbackCounter > redeliveryPolicy.getMaximumRedeliveries()) {
// We need to NACK the messages so that they get sent to the