You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2018/11/14 14:58:39 UTC
[1/2] activemq-artemis git commit: This closes #2425
Repository: activemq-artemis
Updated Branches:
refs/heads/master a20d7a033 -> b4c9910f5
This closes #2425
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b4c9910f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b4c9910f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b4c9910f
Branch: refs/heads/master
Commit: b4c9910f580462b530edc02998fc9cd235c90873
Parents: a20d7a0 5ac8760
Author: Clebert Suconic <cl...@apache.org>
Authored: Wed Nov 14 09:58:34 2018 -0500
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Nov 14 09:58:34 2018 -0500
----------------------------------------------------------------------
.../activemq/artemis/api/core/Message.java | 12 ++
.../artemis/core/message/impl/CoreMessage.java | 15 +++
.../activemq/artemis/reader/MessageUtil.java | 100 +++++++++++++++
.../artemis/jms/client/ActiveMQMessage.java | 121 ++-----------------
.../protocol/amqp/broker/AMQPMessage.java | 4 +-
.../amqp/converter/CoreAmqpConverter.java | 14 ++-
.../amqp/converter/jms/ServerJMSMessage.java | 24 ++--
.../openwire/OpenWireMessageConverter.java | 10 +-
8 files changed, 161 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
[2/2] activemq-artemis git commit: ARTEMIS-2142 Refactor of Patchfix
ServerJMSMessage
Posted by cl...@apache.org.
ARTEMIS-2142 Refactor of Patchfix ServerJMSMessage
Refactor ServerJMSMessage so it correctly transposes all JMSX headers.
Push common JMSX mappings for JMS to Message Interface mappings into MessageUtil to avoid duplication in ActiveMQMessage and ServerJMSMessage
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5ac87609
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5ac87609
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5ac87609
Branch: refs/heads/master
Commit: 5ac87609e70e85397b81b170d6337ada9fa9e89f
Parents: a20d7a0
Author: Michael André Pearce <mi...@me.com>
Authored: Fri Nov 9 15:27:33 2018 +0000
Committer: Clebert Suconic <cl...@apache.org>
Committed: Wed Nov 14 09:58:34 2018 -0500
----------------------------------------------------------------------
.../activemq/artemis/api/core/Message.java | 12 ++
.../artemis/core/message/impl/CoreMessage.java | 15 +++
.../activemq/artemis/reader/MessageUtil.java | 100 +++++++++++++++
.../artemis/jms/client/ActiveMQMessage.java | 121 ++-----------------
.../protocol/amqp/broker/AMQPMessage.java | 4 +-
.../amqp/converter/CoreAmqpConverter.java | 14 ++-
.../amqp/converter/jms/ServerJMSMessage.java | 24 ++--
.../openwire/OpenWireMessageConverter.java | 10 +-
8 files changed, 161 insertions(+), 139 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
index 953e112..5752e7b 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/Message.java
@@ -250,10 +250,22 @@ public interface Message {
return null;
}
+ default Message setGroupID(SimpleString groupID) {
+ return this;
+ }
+
+ default Message setGroupID(String groupID) {
+ return this;
+ }
+
default int getGroupSequence() {
return 0;
}
+ default Message setGroupSequence(int sequence) {
+ return this;
+ }
+
SimpleString getReplyTo();
Message setReplyTo(SimpleString address);
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
index a1e86f5..b14d4b6 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/CoreMessage.java
@@ -290,10 +290,25 @@ public class CoreMessage extends RefCountMessage implements ICoreMessage {
}
@Override
+ public CoreMessage setGroupID(SimpleString groupId) {
+ return this.putStringProperty(Message.HDR_GROUP_ID, groupId);
+ }
+
+ @Override
+ public CoreMessage setGroupID(String groupId) {
+ return this.setGroupID(SimpleString.toSimpleString(groupId, coreMessageObjectPools == null ? null : coreMessageObjectPools.getGroupIdStringSimpleStringPool()));
+ }
+
+ @Override
public int getGroupSequence() {
return containsProperty(Message.HDR_GROUP_SEQUENCE) ? getIntProperty(Message.HDR_GROUP_SEQUENCE) : 0;
}
+ @Override
+ public CoreMessage setGroupSequence(int sequence) {
+ return this.putIntProperty(Message.HDR_GROUP_SEQUENCE, sequence);
+ }
+
/**
* @param sendBuffer
* @param deliveryCount Some protocols (AMQP) will have this as part of the message. ignored on core
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
index 0eceb61..198a933 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java
@@ -19,6 +19,7 @@ package org.apache.activemq.artemis.reader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Objects;
import java.util.Set;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.api.core.ActiveMQPropertyConversionException;
@@ -175,4 +176,103 @@ public class MessageUtil {
(MessageUtil.JMSXGROUPSEQ.equals(name) && message.containsProperty(Message.HDR_GROUP_SEQUENCE)) ||
(MessageUtil.JMSXUSERID.equals(name) && message.containsProperty(Message.HDR_VALIDATED_USER));
}
+
+
+ public static String getStringProperty(final Message message, final String name) {
+ if (MessageUtil.JMSXGROUPID.equals(name)) {
+ return Objects.toString(message.getGroupID(), null);
+ } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ return Integer.toString(message.getGroupSequence());
+ } else if (MessageUtil.JMSXUSERID.equals(name)) {
+ return message.getValidatedUserID();
+ } else {
+ return message.getStringProperty(name);
+ }
+ }
+
+ public static Object getObjectProperty(final Message message, final String name) {
+ final Object val;
+ if (MessageUtil.JMSXGROUPID.equals(name)) {
+ val = message.getGroupID();
+ } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ val = message.getGroupSequence();
+ } else if (MessageUtil.JMSXUSERID.equals(name)) {
+ val = message.getValidatedUserID();
+ } else {
+ val = message.getObjectProperty(name);
+ }
+ if (val instanceof SimpleString) {
+ return val.toString();
+ }
+ return val;
+ }
+
+ public static long getLongProperty(final Message message, final String name) {
+ if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ return message.getGroupSequence();
+ } else {
+ return message.getLongProperty(name);
+ }
+ }
+
+ public static int getIntProperty(final Message message, final String name) {
+ if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ return message.getGroupSequence();
+ } else {
+ return message.getIntProperty(name);
+ }
+ }
+
+ public static void setIntProperty(final Message message, final String name, final int value) {
+ if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ message.setGroupSequence(value);
+ } else {
+ message.putIntProperty(name, value);
+ }
+ }
+
+ public static void setLongProperty(final Message message, final String name, final long value) {
+ if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ message.setGroupSequence((int) value);
+ } else {
+ message.putLongProperty(name, value);
+ }
+ }
+
+ public static void setStringProperty(final Message message, final String name, final String value) {
+ if (MessageUtil.JMSXGROUPID.equals(name)) {
+ message.setGroupID(value);
+ } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ message.setGroupSequence(getInteger(value));
+ } else if (MessageUtil.JMSXUSERID.equals(name)) {
+ message.setValidatedUserID(value);
+ } else {
+ message.putStringProperty(name, value);
+ }
+ }
+
+ public static void setObjectProperty(final Message message, final String name, final Object value) {
+ if (MessageUtil.JMSXGROUPID.equals(name)) {
+ message.setGroupID(value == null ? null : value.toString());
+ } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
+ message.setGroupSequence(getInteger(value));
+ } else if (MessageUtil.JMSXUSERID.equals(name)) {
+ message.setValidatedUserID(value == null ? null : value.toString());
+ } else {
+ message.putObjectProperty(name, value);
+ }
+ }
+
+ private static int getInteger(final Object value) {
+ Objects.requireNonNull(value);
+ final int integer;
+ if (value instanceof Integer) {
+ integer = (Integer) value;
+ } else if (value instanceof Number) {
+ integer = ((Number) value).intValue();
+ } else {
+ integer = Integer.parseInt(value.toString());
+ }
+ return integer;
+ }
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
index 791caa8..af74a3e 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java
@@ -21,7 +21,6 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
-import java.util.Objects;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.IllegalStateException;
@@ -565,10 +564,8 @@ public class ActiveMQMessage implements javax.jms.Message {
try {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return message.getDeliveryCount();
- } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
- return message.getGroupSequence();
} else {
- return message.getIntProperty(name);
+ return MessageUtil.getIntProperty(message, name);
}
} catch (ActiveMQPropertyConversionException e) {
throw new MessageFormatException(e.getMessage());
@@ -580,10 +577,8 @@ public class ActiveMQMessage implements javax.jms.Message {
try {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return message.getDeliveryCount();
- } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
- return message.getGroupSequence();
} else {
- return message.getLongProperty(name);
+ return MessageUtil.getLongProperty(message, name);
}
} catch (ActiveMQPropertyConversionException e) {
throw new MessageFormatException(e.getMessage());
@@ -613,17 +608,8 @@ public class ActiveMQMessage implements javax.jms.Message {
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
return String.valueOf(message.getDeliveryCount());
}
-
try {
- if (MessageUtil.JMSXGROUPID.equals(name)) {
- return Objects.toString(message.getGroupID(), null);
- } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
- return Integer.toString(message.getGroupSequence());
- } else if (MessageUtil.JMSXUSERID.equals(name)) {
- return message.getValidatedUserID();
- } else {
- return message.getStringProperty(name);
- }
+ return MessageUtil.getStringProperty(message, name);
} catch (ActiveMQPropertyConversionException e) {
throw new MessageFormatException(e.getMessage());
}
@@ -631,22 +617,10 @@ public class ActiveMQMessage implements javax.jms.Message {
@Override
public Object getObjectProperty(final String name) throws JMSException {
- final Object val;
if (MessageUtil.JMSXDELIVERYCOUNT.equals(name)) {
- val = message.getDeliveryCount();
- } else if (MessageUtil.JMSXGROUPID.equals(name)) {
- val = message.getGroupID();
- } else if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
- val = message.getGroupSequence();
- } else if (MessageUtil.JMSXUSERID.equals(name)) {
- val = message.getValidatedUserID();
- } else {
- val = message.getObjectProperty(name);
- }
- if (val instanceof SimpleString) {
- return val.toString();
+ return message.getDeliveryCount();
}
- return val;
+ return MessageUtil.getObjectProperty(message, name);
}
@Override
@@ -676,19 +650,13 @@ public class ActiveMQMessage implements javax.jms.Message {
@Override
public void setIntProperty(final String name, final int value) throws JMSException {
checkProperty(name);
- if (handleCoreIntegerProperty(name, value, MessageUtil.JMSXGROUPSEQ, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_SEQUENCE)) {
- return;
- }
- message.putIntProperty(name, value);
+ MessageUtil.setIntProperty(message, name, value);
}
@Override
public void setLongProperty(final String name, final long value) throws JMSException {
checkProperty(name);
- if (handleCoreIntegerProperty(name, value, MessageUtil.JMSXGROUPSEQ, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_SEQUENCE)) {
- return;
- }
- message.putLongProperty(name, value);
+ MessageUtil.setLongProperty(message, name, value);
}
@Override
@@ -706,29 +674,12 @@ public class ActiveMQMessage implements javax.jms.Message {
@Override
public void setStringProperty(final String name, final String value) throws JMSException {
checkProperty(name);
-
- if (handleCoreStringProperty(name, value, MessageUtil.JMSXGROUPID, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID)) {
- return;
- } else if (handleCoreIntegerProperty(name, value, MessageUtil.JMSXGROUPSEQ, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_SEQUENCE)) {
- return;
- } else if (handleCoreStringProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) {
- return;
- } else {
- message.putStringProperty(name, value);
- }
+ MessageUtil.setStringProperty(message, name, value);
}
@Override
public void setObjectProperty(final String name, final Object value) throws JMSException {
- if (handleCoreStringProperty(name, value, MessageUtil.JMSXGROUPID, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_ID)) {
- return;
- }
- if (handleCoreIntegerProperty(name, value, MessageUtil.JMSXGROUPSEQ, org.apache.activemq.artemis.api.core.Message.HDR_GROUP_SEQUENCE)) {
- return;
- }
- if (handleCoreStringProperty(name, value, MessageUtil.JMSXUSERID, org.apache.activemq.artemis.api.core.Message.HDR_VALIDATED_USER)) {
- return;
- }
+
if (ActiveMQJMSConstants.JMS_ACTIVEMQ_OUTPUT_STREAM.equals(name)) {
setOutputStream((OutputStream) value);
@@ -749,7 +700,7 @@ public class ActiveMQMessage implements javax.jms.Message {
checkProperty(name);
try {
- message.putObjectProperty(name, value);
+ MessageUtil.setObjectProperty(message, name, value);
} catch (ActiveMQPropertyConversionException e) {
throw new MessageFormatException(e.getMessage());
}
@@ -1003,57 +954,5 @@ public class ActiveMQMessage implements javax.jms.Message {
}
}
- private boolean handleCoreIntegerProperty(final String name,
- final Object value,
- String jmsPropertyName,
- SimpleString corePropertyName) {
- if (jmsPropertyName.equals(name)) {
- return handleCoreIntegerProperty(name, getInteger(value), jmsPropertyName, corePropertyName);
- }
- return false;
- }
-
- private boolean handleCoreIntegerProperty(final String name,
- final int value,
- String jmsPropertyName,
- SimpleString corePropertyName) {
- boolean result = false;
-
- if (jmsPropertyName.equals(name)) {
- message.putIntProperty(corePropertyName, value);
- result = true;
- }
-
- return result;
- }
-
- private static int getInteger(final Object value) {
- Objects.requireNonNull(value);
- final int integer;
- if (value instanceof Integer) {
- integer = (Integer) value;
- } else if (value instanceof Number) {
- integer = ((Number) value).intValue();
- } else {
- integer = Integer.parseInt(value.toString());
- }
- return integer;
- }
-
- private boolean handleCoreStringProperty(final String name,
- final Object value,
- String jmsPropertyName,
- SimpleString corePropertyName) {
- boolean result = false;
-
- if (jmsPropertyName.equals(name)) {
- message.putStringProperty(corePropertyName, value == null ? null : value.toString());
-
- result = true;
- }
-
- return result;
- }
-
// Inner classes -------------------------------------------------
}
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
index ab67330..990ec3a 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/broker/AMQPMessage.java
@@ -929,7 +929,7 @@ public class AMQPMessage extends RefCountMessage {
@Override
public org.apache.activemq.artemis.api.core.Message setUserID(Object userID) {
- return null;
+ return this;
}
@Override
@@ -1219,6 +1219,8 @@ public class AMQPMessage extends RefCountMessage {
return getConnectionID();
} else if (key.equals(MessageUtil.JMSXGROUPID)) {
return getGroupID();
+ } else if (key.equals(MessageUtil.JMSXGROUPSEQ)) {
+ return getGroupSequence();
} else if (key.equals(MessageUtil.JMSXUSERID)) {
return getAMQPUserID();
} else if (key.equals(MessageUtil.CORRELATIONID_HEADER_NAME.toString())) {
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
index 200321c..cba15e0 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/CoreAmqpConverter.java
@@ -209,15 +209,17 @@ public class CoreAmqpConverter {
if (key.startsWith("JMSX")) {
if (key.equals("JMSXUserID")) {
String value = message.getStringProperty(key);
- properties.setUserId(new Binary(value.getBytes(StandardCharsets.UTF_8)));
+ if (value != null) {
+ properties.setUserId(Binary.create(StandardCharsets.UTF_8.encode(value)));
+ }
continue;
} else if (key.equals("JMSXGroupID")) {
String value = message.getStringProperty(key);
properties.setGroupId(value);
continue;
} else if (key.equals("JMSXGroupSeq")) {
- UnsignedInteger value = new UnsignedInteger(message.getIntProperty(key));
- properties.setGroupSequence(value);
+ int value = message.getIntProperty(key);
+ properties.setGroupSequence(UnsignedInteger.valueOf(value));
continue;
}
} else if (key.startsWith(JMS_AMQP_PREFIX)) {
@@ -281,10 +283,14 @@ public class CoreAmqpConverter {
footerMap.put(name, message.getObjectProperty(key));
continue;
}
- } else if (key.equals("_AMQ_GROUP_ID")) {
+ } else if (key.equals(Message.HDR_GROUP_ID)) {
String value = message.getStringProperty(key);
properties.setGroupId(value);
continue;
+ } else if (key.equals(Message.HDR_GROUP_SEQUENCE)) {
+ int value = message.getIntProperty(key);
+ properties.setGroupSequence(UnsignedInteger.valueOf(value));
+ continue;
} else if (key.equals(NATIVE_MESSAGE_ID)) {
// skip..internal use only
continue;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMessage.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMessage.java
index 51e8adc..abc324e 100644
--- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMessage.java
+++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/jms/ServerJMSMessage.java
@@ -266,16 +266,12 @@ public class ServerJMSMessage implements Message {
@Override
public final int getIntProperty(String name) throws JMSException {
- if (MessageUtil.JMSXGROUPSEQ.equals(name)) {
- return message.getGroupSequence();
- } else {
- return message.getIntProperty(name);
- }
+ return MessageUtil.getIntProperty(message, name);
}
@Override
public final long getLongProperty(String name) throws JMSException {
- return message.getLongProperty(name);
+ return MessageUtil.getLongProperty(message, name);
}
@Override
@@ -290,16 +286,12 @@ public class ServerJMSMessage implements Message {
@Override
public final String getStringProperty(String name) throws JMSException {
- return message.getStringProperty(name);
+ return MessageUtil.getStringProperty(message, name);
}
@Override
public final Object getObjectProperty(String name) throws JMSException {
- Object val = message.getObjectProperty(name);
- if (val instanceof SimpleString) {
- val = ((SimpleString) val).toString();
- }
- return val;
+ return MessageUtil.getObjectProperty(message, name);
}
@Override
@@ -324,12 +316,12 @@ public class ServerJMSMessage implements Message {
@Override
public final void setIntProperty(String name, int value) throws JMSException {
- message.putIntProperty(name, value);
+ MessageUtil.setIntProperty(message, name, value);
}
@Override
public final void setLongProperty(String name, long value) throws JMSException {
- message.putLongProperty(name, value);
+ MessageUtil.setLongProperty(message, name, value);
}
@Override
@@ -344,12 +336,12 @@ public class ServerJMSMessage implements Message {
@Override
public final void setStringProperty(String name, String value) throws JMSException {
- message.putStringProperty(name, value);
+ MessageUtil.setStringProperty(message, name, value);
}
@Override
public final void setObjectProperty(String name, Object value) throws JMSException {
- message.putObjectProperty(name, value);
+ MessageUtil.setObjectProperty(message, name, value);
}
@Override
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5ac87609/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
index e958267..cdf0cee 100644
--- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
+++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
@@ -173,9 +173,9 @@ public final class OpenWireMessageConverter {
}
final String groupId = messageSend.getGroupID();
if (groupId != null) {
- coreMessage.putStringProperty(AMQ_MSG_GROUP_ID, coreMessageObjectPools.getGroupIdStringSimpleStringPool().getOrCreate(groupId));
+ coreMessage.setGroupID(groupId);
}
- coreMessage.putIntProperty(AMQ_MSG_GROUP_SEQUENCE, messageSend.getGroupSequence());
+ coreMessage.setGroupSequence(messageSend.getGroupSequence());
final MessageId messageId = messageSend.getMessageId();
@@ -614,11 +614,7 @@ public final class OpenWireMessageConverter {
amqMsg.setGroupID(groupId);
}
- Integer groupSequence = (Integer) coreMessage.getObjectProperty(AMQ_MSG_GROUP_SEQUENCE);
- if (groupSequence == null) {
- groupSequence = 0;
- }
- amqMsg.setGroupSequence(groupSequence);
+ amqMsg.setGroupSequence(coreMessage.getGroupSequence());
final MessageId mid;
final byte[] midBytes = (byte[]) coreMessage.getObjectProperty(AMQ_MSG_MESSAGE_ID);