mirror of https://github.com/apache/activemq.git
Found some issues with the client ack handling for stomp and bytes message conversion while looking into:
https://issues.apache.org/activemq/browse/AMQ-978 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@465987 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d778fa4601
commit
76efc33cdb
|
@ -54,6 +54,7 @@ public class LegacyFrameTranslator implements FrameTranslator
|
|||
} else if( message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE ) {
|
||||
|
||||
ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy();
|
||||
msg.setReadOnlyBody(true);
|
||||
byte[] data = new byte[(int)msg.getBodyLength()];
|
||||
msg.readBytes(data);
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ package org.apache.activemq.transport.stomp;
|
|||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.jms.JMSException;
|
||||
|
||||
|
@ -91,18 +93,23 @@ public class StompSubscription {
|
|||
ack.setConsumerId(consumerInfo.getConsumerId());
|
||||
|
||||
int count=0;
|
||||
for (Iterator iter = dispatchedMessage.keySet().iterator(); iter.hasNext();) {
|
||||
for (Iterator iter = dispatchedMessage.entrySet().iterator(); iter.hasNext();) {
|
||||
|
||||
Map.Entry entry = (Entry) iter.next();
|
||||
String id = (String) entry.getKey();
|
||||
MessageId msgid = (MessageId) entry.getValue();
|
||||
|
||||
String id = (String) iter.next();
|
||||
if( ack.getFirstMessageId()==null )
|
||||
ack.setFirstMessageId((MessageId) dispatchedMessage.get(id));
|
||||
ack.setFirstMessageId(msgid);
|
||||
|
||||
iter.remove();
|
||||
count++;
|
||||
|
||||
if( id.equals(messageId) ) {
|
||||
ack.setLastMessageId((MessageId) dispatchedMessage.get(id));
|
||||
ack.setLastMessageId(msgid);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ack.setMessageCount(count);
|
||||
|
|
Loading…
Reference in New Issue