You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/02/11 08:07:25 UTC

[GitHub] [activemq-artemis] michaelandrepearce commented on a change in pull request #3450: ARTEMIS-3113 - Artemis AMQP shouldn't depend on JMS.

michaelandrepearce commented on a change in pull request #3450:
URL: https://github.com/apache/activemq-artemis/pull/3450#discussion_r574307737



##########
File path: artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/converter/AMQPMessageSupport.java
##########
@@ -396,36 +371,54 @@ private static CoreMessage newMessage(long id, byte messageType, CoreMessageObje
    }
 
 
-   public static byte destinationType(Destination destination) {
-      if (destination instanceof Queue) {
-         if (destination instanceof TemporaryQueue) {
-            return TEMP_QUEUE_TYPE;
-         } else {
-            return QUEUE_TYPE;
-         }
-      } else if (destination instanceof Topic) {
-         if (destination instanceof TemporaryTopic) {
-            return TEMP_TOPIC_TYPE;
-         } else {
-            return TOPIC_TYPE;
-         }
+   public static String toAddress(String destination) {
+
+      if (destination.startsWith(DestinationUtil.QUEUE_QUALIFIED_PREFIX)) {
+         return destination.substring(DestinationUtil.QUEUE_QUALIFIED_PREFIX.length());
+      } else if (destination.startsWith(DestinationUtil.TOPIC_QUALIFIED_PREFIX)) {
+         return destination.substring(DestinationUtil.TOPIC_QUALIFIED_PREFIX.length());
+      } else if (destination.startsWith(DestinationUtil.TEMP_QUEUE_QUALIFED_PREFIX)) {
+         return destination.substring(DestinationUtil.TEMP_QUEUE_QUALIFED_PREFIX.length());
+      } else if (destination.startsWith(DestinationUtil.TEMP_TOPIC_QUALIFED_PREFIX)) {
+         return destination.substring(DestinationUtil.TEMP_TOPIC_QUALIFED_PREFIX.length());
+      } else {
+         return destination;
       }
+   }
 
+   public static byte destinationType(String destination) {
+      if (destination.startsWith(QUEUE_QUALIFIED_PREFIX)) {
+         return QUEUE_TYPE;
+      }
+      if (destination.startsWith(TOPIC_QUALIFIED_PREFIX)) {
+         return TOPIC_TYPE;
+      }
+      if (destination.startsWith(TEMP_QUEUE_QUALIFED_PREFIX)) {
+         return TEMP_QUEUE_TYPE;
+      }
+      if (destination.startsWith(TEMP_TOPIC_QUALIFED_PREFIX)) {
+         return TEMP_TOPIC_TYPE;
+      }
       return QUEUE_TYPE;
    }
 
-   public static Destination destination(byte destinationType, String address) {
+   public static String destination(RoutingType destinationType, String address) {
+      String prefix;
+
+      if (destinationType == null) {
+         destinationType = RoutingType.ANYCAST;
+      }
+
       switch (destinationType) {
-         case TEMP_QUEUE_TYPE:
-            return new ActiveMQTemporaryQueue(address, null);
-         case TEMP_TOPIC_TYPE:
-            return new ActiveMQTemporaryTopic(address, null);
-         case TOPIC_TYPE:
-            return new ActiveMQTopic(address);
-         case QUEUE_TYPE:
-            return new ActiveMQQueue(address);
-         default:
-            return new ActiveMQQueue(address);
+         case ANYCAST: prefix = QUEUE_QUALIFIED_PREFIX; break;

Review comment:
       This looks like it no longer handles temporaries




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org