Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-5954

Fix for failing activeMq bridge

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.11.1
    • 5.14.0
    • Broker
    • None

    Description

      We have a system using activeMQ and weblogic, where we found that after upgrading weblogic server from 12.1.1 to 12.1.3 the bridge stopped working. We've found the cause and fixed it (oracle refused to fix their code), and would like you to add the fix to activemq so we can remove the local hack we've made. Look for the "//new code" in the code sample furthest down in this description

      Cause: Oracle changed the method getQueueName() in weblogic.jms.common.DestinationImpl.java so that it returns null if the object received is not the correct type (a Topic instead of a Queue for instance). In previous version the method returned the name regardless of type. The missing name casues the bridge to fail.

      The object received in our case is an implementation of the Destination interface, DistributedDestinationImpl, which implements both these interfaces in its parent class DestinationImpl. In org.apache.activemq.ActiveMQMessageTransformation.transformDestination(...) where the instanceof TemporaryQueue/TemporaryTopic++ tests will always return true for both TemporaryQueue and TemporaryTopic. The code will enter the first if() in the code below because of this and call the getQueueName() method even if it is a Topic, and will return null.

      ActiveMQMessageTransformation.java (old version):

          public static ActiveMQDestination transformDestination(Destination destination) throws JMSException {
              ActiveMQDestination activeMQDestination = null;
      
              if (destination != null) {
                  if (destination instanceof ActiveMQDestination) {
                      return (ActiveMQDestination)destination;
      
                  } else {
                      if (destination instanceof TemporaryQueue) {
                          activeMQDestination = new ActiveMQTempQueue(((Queue)destination).getQueueName());
                      } else if (destination instanceof TemporaryTopic) {
                          activeMQDestination = new ActiveMQTempTopic(((Topic)destination).getTopicName());
                      } else if (destination instanceof Queue) {
                          activeMQDestination = new ActiveMQQueue(((Queue)destination).getQueueName());
                      } else if (destination instanceof Topic) {
                          activeMQDestination = new ActiveMQTopic(((Topic)destination).getTopicName());
                      }
                  }
              }
      
              return activeMQDestination;
          }
      

      The fixed version test for this case and calls the UnresolvableDestinationTransformer which was added to activemq as a response to issue AMQ-3401:

          public static ActiveMQDestination transformDestination(Destination destination) throws JMSException {
              ActiveMQDestination activeMQDestination = null;
      
              if (destination != null) {
                  if (destination instanceof ActiveMQDestination) {
                      return (ActiveMQDestination)destination;
      
                  } else {
                      //start new code
                      if (destination instanceof TemporaryQueue && destination instanceof TemporaryTopic) {
                          activeMQDestination = ActiveMQDestination.getUnresolvableDestinationTransformer().transform(destination);
                      } else
                      //end new code
                      if (destination instanceof TemporaryQueue) {
                          activeMQDestination = new ActiveMQTempQueue(((Queue)destination).getQueueName());
                      } else if (destination instanceof TemporaryTopic) {
                          activeMQDestination = new ActiveMQTempTopic(((Topic)destination).getTopicName());
                      } else if (destination instanceof Queue) {
                          activeMQDestination = new ActiveMQQueue(((Queue)destination).getQueueName());
                      } else if (destination instanceof Topic) {
                          activeMQDestination = new ActiveMQTopic(((Topic)destination).getTopicName());
                      }
                  }
              }
      
              return activeMQDestination;
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            darkvalley Knut Skomedal
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: