camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: Problem with ActiveMQ to Weblogic route
Date Thu, 14 Jul 2011 13:47:38 GMT
It makes sense to fix it up such that it can work in your case and I
guess to future proof it a bit.
The solution may be to make it configurable or plugable, adding a
fallback transformer implementation that can be delegated to in this
case.

I imagine a new public static
ActiveMQDestination.setFallbackTransformer() with something that
implements
  public ActiveMQDestination transform(Destination dest) throws JMSException

Can you raise a jira issue against activemq to track this?

On 14 July 2011 12:35, pwanner <pwanner@pwanner.com> wrote:
> 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.
>



-- 
http://fusesource.com
http://blog.garytully.com

Mime
View raw message