activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbert...@apache.org
Subject activemq-artemis git commit: Don't set routingType header on JMS producer as this breaks backwards compatibility
Date Wed, 30 Nov 2016 22:54:55 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/ARTEMIS-780 73691a503 -> 8338080a9


Don't set routingType header on JMS producer as this breaks backwards compatibility


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/8338080a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/8338080a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/8338080a

Branch: refs/heads/ARTEMIS-780
Commit: 8338080a9be1b3ee317a766423468b39bf6bf64b
Parents: 73691a5
Author: jbertram <jbertram@apache.com>
Authored: Wed Nov 30 16:45:00 2016 -0600
Committer: jbertram <jbertram@apache.com>
Committed: Wed Nov 30 16:54:08 2016 -0600

----------------------------------------------------------------------
 .../activemq/artemis/reader/MessageUtil.java    | 14 +++----------
 .../artemis/jms/client/ActiveMQMessage.java     | 21 +++++++++-----------
 .../jms/client/ActiveMQMessageConsumer.java     |  7 +++++++
 .../jms/client/ActiveMQMessageProducer.java     |  3 ---
 4 files changed, 19 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8338080a/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 9d37cd3..507a454 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
@@ -120,19 +120,11 @@ public class MessageUtil {
    }
 
    public static void clearProperties(Message message) {
-      /**
-       * JavaDoc for this method states:
-       *    Clears a message's properties.
-       *    The message's header fields and body are not cleared.
-       *
-       * Since the {@code Message.HDR_ROUTING_TYPE} is used for the JMSDestination header
it isn't cleared
-       */
-
       List<SimpleString> toRemove = new ArrayList<>();
 
       for (SimpleString propName : message.getPropertyNames()) {
-         if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
-            propName.startsWith(JMS_)) && !propName.equals(Message.HDR_ROUTING_TYPE))
{
+         if (!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
+            propName.startsWith(JMS_)) {
             toRemove.add(propName);
          }
       }
@@ -147,7 +139,7 @@ public class MessageUtil {
 
       for (SimpleString propName : message.getPropertyNames()) {
          if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) ||
-            propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME)
&& !propName.equals(Message.HDR_ROUTING_TYPE)) {
+            propName.startsWith(JMS_)) && !propName.startsWith(CONNECTION_ID_PROPERTY_NAME))
{
             set.add(propName.toString());
          }
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8338080a/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 4f0be81..ff583aa 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
@@ -202,9 +202,11 @@ public class ActiveMQMessage implements javax.jms.Message {
 
    private long jmsDeliveryTime;
 
+   private boolean fromQueue;
+
    // Constructors --------------------------------------------------
 
-   /*
+   /*g
     * Create a new message prior to sending
     */
    protected ActiveMQMessage(final byte type, final ClientSession session) {
@@ -398,17 +400,8 @@ public class ActiveMQMessage implements javax.jms.Message {
    public Destination getJMSDestination() throws JMSException {
       if (dest == null) {
          SimpleString address = message.getAddress();
-         String prefix = "";
-         if (message.containsProperty(org.apache.activemq.artemis.api.core.Message.HDR_ROUTING_TYPE))
{
-            RoutingType routingType = RoutingType.getType(message.getByteProperty(org.apache.activemq.artemis.api.core.Message.HDR_ROUTING_TYPE));
-            if (routingType.equals(RoutingType.ANYCAST)) {
-               prefix = QUEUE_QUALIFIED_PREFIX;
-            } else if (routingType.equals(RoutingType.MULTICAST)) {
-               prefix = TOPIC_QUALIFIED_PREFIX;
-            }
-         }
 
-         dest = address == null ? null : ActiveMQDestination.fromPrefixedName(prefix + address.toString());
+         dest = address == null ? null : ActiveMQDestination.fromPrefixedName((fromQueue
? QUEUE_QUALIFIED_PREFIX : TOPIC_QUALIFIED_PREFIX) + address.toString());
       }
 
       return dest;
@@ -785,7 +778,11 @@ public class ActiveMQMessage implements javax.jms.Message {
       return message.getBodySize() == 0;
    }
 
-   // Public --------------------------------------------------------
+   // Public ---------------------------------------------------------
+
+   public void setFromQueue(boolean fromQueue) {
+      this.fromQueue = fromQueue;
+   }
 
    public void setIndividualAcknowledge() {
       this.individualAck = true;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8338080a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
index 8bc1fd8..ec362fa 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageConsumer.java
@@ -60,6 +60,8 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
 
    private final ActiveMQDestination destination;
 
+   private final boolean destinationIsQueue;
+
    private final String selector;
 
    private final SimpleString autoDeleteQueueName;
@@ -88,6 +90,8 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
 
       this.destination = destination;
 
+      this.destinationIsQueue = destination instanceof ActiveMQQueue;
+
       this.selector = selector;
 
       this.autoDeleteQueueName = autoDeleteQueueName;
@@ -240,6 +244,9 @@ public final class ActiveMQMessageConsumer implements QueueReceiver, TopicSubscr
             } else {
                coreMessage.acknowledge();
             }
+
+            // TODO find a more elegant way to do this
+            jmsMsg.setFromQueue(destinationIsQueue);
          }
 
          return jmsMsg;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/8338080a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
----------------------------------------------------------------------
diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
index 4c1d335..47d9ff2 100644
--- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
+++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessageProducer.java
@@ -491,9 +491,6 @@ public class ActiveMQMessageProducer implements MessageProducer, QueueSender,
To
       ClientMessage coreMessage = activeMQJmsMessage.getCoreMessage();
       coreMessage.putStringProperty(ActiveMQConnection.CONNECTION_ID_PROPERTY_NAME, connID);
 
-      byte routingType = destination.isQueue() ? RoutingType.ANYCAST.getType() : RoutingType.MULTICAST.getType();
-      coreMessage.putByteProperty(org.apache.activemq.artemis.api.core.Message.HDR_ROUTING_TYPE,
routingType);
-
       try {
          /**
           * Using a completionListener requires wrapping using a {@link CompletionListenerWrapper},


Mime
View raw message