mirror of https://github.com/apache/activemq.git
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:
parent
1eaf1f7274
commit
f0454b1e88
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue