activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1416516 - /activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
Date Mon, 03 Dec 2012 13:43:22 GMT
Author: chirino
Date: Mon Dec  3 13:43:22 2012
New Revision: 1416516

URL: http://svn.apache.org/viewvc?rev=1416516&view=rev
Log:
When we transform JMS to AMQP messages preserve destination type info.

Modified:
    activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java

Modified: activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java?rev=1416516&r1=1416515&r2=1416516&view=diff
==============================================================================
--- activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
(original)
+++ activemq/trunk/activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/ActiveMQJMSVendor.java
Mon Dec  3 13:43:22 2012
@@ -5,6 +5,7 @@ import org.apache.qpid.proton.jms.JMSVen
 
 import javax.jms.*;
 import javax.jms.Message;
+import java.util.Set;
 
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -46,8 +47,25 @@ public class ActiveMQJMSVendor extends J
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     public Destination createDestination(String name) {
-        return ActiveMQDestination.createDestination(name, ActiveMQDestination.QUEUE_TYPE);
+        return super.createDestination(name, Destination.class);
+    }
+
+    public <T extends Destination> T createDestination(String name, Class<T>
kind) {
+        if( kind == Queue.class ) {
+            return kind.cast(new ActiveMQQueue(name));
+        }
+        if( kind == Topic.class ) {
+            return kind.cast(new ActiveMQTopic(name));
+        }
+        if( kind == TemporaryQueue.class ) {
+            return kind.cast(new ActiveMQTempQueue(name));
+        }
+        if( kind == TemporaryTopic.class ) {
+            return kind.cast(new ActiveMQTempTopic(name));
+        }
+        return kind.cast(ActiveMQDestination.createDestination(name, ActiveMQDestination.QUEUE_TYPE));
     }
 
     @Override



Mime
View raw message