Forced to copy message before leaving the consumer - as the destination could change if

the message is forwarded on.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@374795 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2006-02-04 00:35:53 +00:00
parent e1bc55dafe
commit 641140ebab
1 changed files with 2 additions and 1 deletions

View File

@ -415,7 +415,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
* @return
*/
private ActiveMQMessage createActiveMQMessage(final MessageDispatch md) {
ActiveMQMessage m = (ActiveMQMessage) md.getMessage();
ActiveMQMessage m = (ActiveMQMessage) md.getMessage().copy();
if (session.isClientAcknowledge()) {
m.setAcknowledgeCallback(new Callback() {
public void execute() throws Throwable {
@ -623,6 +623,7 @@ public class ActiveMQMessageConsumer implements MessageAvailableConsumer, StatsC
// Acknowledge the last message.
MessageDispatch lastMd = (MessageDispatch) deliveredMessages.get(0);
System.err.println(this + " ACKING " + lastMd.getMessage().getMessageId() + " size = " + deliveredMessages.size());
MessageAck ack = new MessageAck(lastMd, MessageAck.STANDARD_ACK_TYPE, deliveredMessages.size());
if (session.isTransacted()) {
session.doStartTransaction();