Yes this class is part of activemq-core-5.5.0.jar.

I did a modification that works correctly reflecting the Destination
parameter to check if in the case of weblogic.jms.common.DestinationImpl is
has the isQueue and isTopic methods that could help to determine between
Queue and Topic.

As the problem is closely related to a Weblogic implementation class, I'm
not sure that ActiveMQ would like to embed it in its distribution, even that
using reflection avoid having a dependency to the Weblogic jar.


The modification is in bold below:

    public static ActiveMQDestination transform(Destination dest) throws
JMSException {
        if (dest == null) {
            return null;
        }
        if (dest instanceof ActiveMQDestination) {
            return (ActiveMQDestination)dest;
        }
        
        if (dest instanceof Queue && dest instanceof Topic) {
            String queueName = ((Queue) dest).getQueueName();
            String topicName = ((Topic) dest).getTopicName();

            if (queueName != null && topicName == null) {
                return new ActiveMQQueue(queueName);
            } else if (queueName == null && topicName != null) {
                return new ActiveMQTopic(topicName);
            }
            
*            
            Method isQueueMethod = null;
            Method isTopicMethod = null;
            try {
                isQueueMethod = dest.getClass().getMethod("isQueue");
                isTopicMethod = dest.getClass().getMethod("isTopic");
                Boolean isQueue = (Boolean)isQueueMethod.invoke(dest);
                Boolean isTopic = (Boolean)isTopicMethod.invoke(dest);
                if(isQueue) {
                    return new ActiveMQQueue(queueName);
                } else if(isTopic){
                    return new ActiveMQTopic(topicName);
                }
            } catch (Exception e) {}
*
          throw new JMSException("Could no disambiguate on queue|Topic-name
totransform pollymorphic destination into a ActiveMQ destination: " + dest);
        }
        if (dest instanceof TemporaryQueue) {
            return new
ActiveMQTempQueue(((TemporaryQueue)dest).getQueueName());
        }
        if (dest instanceof TemporaryTopic) {
            return new
ActiveMQTempTopic(((TemporaryTopic)dest).getTopicName());
        }
        if (dest instanceof Queue) {
            return new ActiveMQQueue(((Queue)dest).getQueueName());
        }
        if (dest instanceof Topic) {
            return new ActiveMQTopic(((Topic)dest).getTopicName());
        }
        throw new JMSException("Could not transform the destination into a
ActiveMQ destination: " + dest);
    }

--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-ActiveMQ-to-Weblogic-route-tp4578300p4586327.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to