Repository: activemq-artemis Updated Branches: refs/heads/2.6.x 5bd533a97 -> 8ac9f8d30
Revert "ARTEMIS-2139 Ensure 1.x Client reply to address is correct" This reverts commit cad1e9a630ddfb4647d7ee59c83195d98fbf1d30. Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5a113ff3 Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5a113ff3 Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5a113ff3 Branch: refs/heads/2.6.x Commit: 5a113ff352dde926094a23a3c5134b16349be8e3 Parents: 5bd533a Author: Martyn Taylor <[email protected]> Authored: Fri Oct 26 09:24:29 2018 +0100 Committer: Martyn Taylor <[email protected]> Committed: Fri Oct 26 09:24:29 2018 +0100 ---------------------------------------------------------------------- .../artemis/jms/client/ActiveMQDestination.java | 37 ++++++++++++++------ .../artemis/jms/client/ActiveMQMessage.java | 28 +++++++-------- 2 files changed, 38 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5a113ff3/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java ---------------------------------------------------------------------- diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java index a349e3e..6d1b409 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java @@ -91,24 +91,39 @@ public class ActiveMQDestination extends JNDIStorable implements Destination, Se return fromPrefixedName(name, name); } - public static Destination fromPrefixedName(final String addr, String name) { + public static Destination fromPrefixedName(final String addr, final String name) { ActiveMQDestination destination; + if (addr.startsWith(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX)) { + String address = addr.substring(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX.length()); + destination = createQueue(address); + } else if (addr.startsWith(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX)) { + String address = addr.substring(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX.length()); + destination = createTopic(address); + } else if (addr.startsWith(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX)) { + String address = addr.substring(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX.length()); + destination = new ActiveMQTemporaryQueue(address, null); + } else if (addr.startsWith(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX)) { + String address = addr.substring(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX.length()); + destination = new ActiveMQTemporaryTopic(address, null); + } else { + destination = new ActiveMQDestination(addr, TYPE.DESTINATION, null); + } + + String unprefixedName = name; + if (name.startsWith(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX)) { - name = name.substring(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX.length()); - destination = createQueue(addr, name); + unprefixedName = name.substring(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX.length()); } else if (name.startsWith(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX)) { - name = name.substring(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX.length()); - destination = createTopic(addr, name); + unprefixedName = name.substring(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX.length()); } else if (name.startsWith(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX)) { - name = name.substring(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX.length()); - destination = new ActiveMQTemporaryQueue(addr, null); + unprefixedName = name.substring(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX.length()); } else if (name.startsWith(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX)) { - name = name.substring(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX.length()); - destination = new ActiveMQTemporaryTopic(addr, null); - } else { - destination = new ActiveMQDestination(addr, TYPE.DESTINATION, null); + unprefixedName = name.substring(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX.length()); } + + destination.setName(unprefixedName); + return destination; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5a113ff3/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 ea3ccb5..ff7da00 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 @@ -66,8 +66,10 @@ public class ActiveMQMessage implements javax.jms.Message { // Constants ----------------------------------------------------- public static final byte TYPE = org.apache.activemq.artemis.api.core.Message.DEFAULT_TYPE; - public static final String QUEUE_PREFIX = PacketImpl.OLD_QUEUE_PREFIX.toString(); - public static final String TOPIC_PREFIX = PacketImpl.OLD_TOPIC_PREFIX.toString(); + public static final SimpleString OLD_QUEUE_QUALIFIED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX + PacketImpl.OLD_QUEUE_PREFIX); + public static final SimpleString OLD_TEMP_QUEUE_QUALIFED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX + PacketImpl.OLD_TEMP_QUEUE_PREFIX); + public static final SimpleString OLD_TOPIC_QUALIFIED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + PacketImpl.OLD_TOPIC_PREFIX); + public static final SimpleString OLD_TEMP_TOPIC_QUALIFED_PREFIX = SimpleString.toSimpleString(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX + PacketImpl.OLD_TEMP_TOPIC_PREFIX); public static Map<String, Object> coreMaptoJMSMap(final Map<String, Object> coreMessage) { Map<String, Object> jmsMessage = new HashMap<>(); @@ -370,20 +372,14 @@ public class ActiveMQMessage implements javax.jms.Message { // swap the old prefixes for the new ones so the proper destination type gets created if (enable1xPrefixes) { - if (name.startsWith(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX)) { - name = name.substring(ActiveMQDestination.QUEUE_QUALIFIED_PREFIX.length()); - } else if (name.startsWith(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX)) { - name = name.substring(ActiveMQDestination.TOPIC_QUALIFIED_PREFIX.length()); - } else if (name.startsWith(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX)) { - name = name.substring(ActiveMQDestination.TEMP_QUEUE_QUALIFED_PREFIX.length()); - } else if (name.startsWith(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX)) { - name = name.substring(ActiveMQDestination.TEMP_TOPIC_QUALIFED_PREFIX.length()); - } - - if (name.startsWith(QUEUE_PREFIX)) { - name = ActiveMQDestination.QUEUE_QUALIFIED_PREFIX + name.substring(QUEUE_PREFIX.length()); - } else if (name.startsWith(TOPIC_PREFIX)) { - name = ActiveMQDestination.TOPIC_QUALIFIED_PREFIX + name.substring(TOPIC_PREFIX.length()); + if (address.startsWith(OLD_QUEUE_QUALIFIED_PREFIX)) { + name = address.subSeq(OLD_QUEUE_QUALIFIED_PREFIX.length(), address.length()).toString(); + } else if (address.startsWith(OLD_TEMP_QUEUE_QUALIFED_PREFIX)) { + name = address.subSeq(OLD_TEMP_QUEUE_QUALIFED_PREFIX.length(), address.length()).toString(); + } else if (address.startsWith(OLD_TOPIC_QUALIFIED_PREFIX)) { + name = address.subSeq(OLD_TOPIC_QUALIFIED_PREFIX.length(), address.length()).toString(); + } else if (address.startsWith(OLD_TEMP_TOPIC_QUALIFED_PREFIX)) { + name = address.subSeq(OLD_TEMP_TOPIC_QUALIFED_PREFIX.length(), address.length()).toString(); } } replyTo = ActiveMQDestination.fromPrefixedName(address.toString(), name);
