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

JmsTopicConnector checks for presence of localClientId then uses outboundClientId

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.4.2
    • 5.6.0
    • Connector
    • None
    • running 5.4.2 on linux.

    Description

      On the JMS bridge topic connector, if I set the outboundClientId but not the localClientId, then the outbound client id will not be set.
      This is because the JmsTopicConnector only sets the outboundClientId if the localClientId is set. This appears to be a bug.

      Here is 5.4.2 JmsTopicConnector.initializeForeignTopicConnection

          protected void initializeForeignTopicConnection() throws NamingException, JMSException {
              if (outboundTopicConnection == null) {
                  // get the connection factories
                  if (outboundTopicConnectionFactory == null) {
                      // look it up from JNDI
                      if (outboundTopicConnectionFactoryName != null) {
                          outboundTopicConnectionFactory = (TopicConnectionFactory)jndiOutboundTemplate
                              .lookup(outboundTopicConnectionFactoryName, TopicConnectionFactory.class);
                          if (outboundUsername != null) {
                              outboundTopicConnection = outboundTopicConnectionFactory
                                  .createTopicConnection(outboundUsername, outboundPassword);
                          } else {
                              outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                          }
                      } else {
                          throw new JMSException("Cannot create localConnection - no information");
                      }
                  } else {
                      if (outboundUsername != null) {
                          outboundTopicConnection = outboundTopicConnectionFactory
                              .createTopicConnection(outboundUsername, outboundPassword);
                      } else {
                          outboundTopicConnection = outboundTopicConnectionFactory.createTopicConnection();
                      }
                  }
              }
      >>>>    if (localClientId != null && localClientId.length() > 0) {           // CHECKS for existence of localClientId
                  outboundTopicConnection.setClientID(getOutboundClientId());      // THEN uses outboundClientId
              }
              outboundTopicConnection.start();
          }
      
      

      I'm thinking the above code should check for existence of outboundClientId instead of localClientId

      Compare this to:

          protected void initializeLocalTopicConnection() throws NamingException, JMSException {
              if (localTopicConnection == null) {
                  // get the connection factories
                  if (localTopicConnectionFactory == null) {
                      if (embeddedConnectionFactory == null) {
                          // look it up from JNDI
                          if (localConnectionFactoryName != null) {
                              localTopicConnectionFactory = (TopicConnectionFactory)jndiLocalTemplate
                                  .lookup(localConnectionFactoryName, TopicConnectionFactory.class);
                              if (localUsername != null) {
                                  localTopicConnection = localTopicConnectionFactory
                                      .createTopicConnection(localUsername, localPassword);
                              } else {
                                  localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                              }
                          } else {
                              throw new JMSException("Cannot create localConnection - no information");
                          }
                      } else {
                          localTopicConnection = embeddedConnectionFactory.createTopicConnection();
                      }
                  } else {
                      if (localUsername != null) {
                          localTopicConnection = localTopicConnectionFactory.createTopicConnection(localUsername,
                                                                                                   localPassword);
                      } else {
                          localTopicConnection = localTopicConnectionFactory.createTopicConnection();
                      }
                  }
              }
      >>>>        if (localClientId != null && localClientId.length() > 0) {    // CHECKS for existence of localClientId
                  localTopicConnection.setClientID(getLocalClientId());         // THEN uses localClientId
              }
              localTopicConnection.start();
          }
      
      

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            jeffgillings Jeff Gillings
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: