diff --git a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java index f205904836..4c9f5b7e9d 100755 --- a/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java +++ b/activemq-core/src/main/java/org/apache/activemq/ActiveMQMessageConsumer.java @@ -189,8 +189,9 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC this.session.removeConsumer(this); throw e; } - this.optimizeAcknowledge=session.connection.isOptimizeAcknowledge()&&session.isAutoAcknowledge(); - if (session.connection.isStarted()) + this.optimizeAcknowledge=session.connection.isOptimizeAcknowledge()&&session.isAutoAcknowledge() + &&!info.isDurable()&&!info.getDestination().isQueue(); + if(session.connection.isStarted()) start(); } @@ -507,6 +508,10 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC this.session.syncSendPacket(info.createRemoveCommand()); } } + + public void clearMessagesInProgress(){ + unconsumedMessages.clear(); + } public void dispose() throws JMSException { if (!unconsumedMessages.isClosed()) {