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

The Camel ActiveMQComponent should default create ActiveMQConnectionFactory with the provided broker url

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.4.2
    • 5.5.0
    • Broker
    • None

    Description

      When using the ActiveMQComponent to create a Camel component and you provide the broker URL as follows on the static method on ActiveMQComponent:

      ActiveMQComponent activemq = activeMQComponent(""vm://localhost?broker.persistent=false&broker.useJmx=false");
      

      It does not set a default ActiveMQConnectionFactory with that provided URL. So later when it creates a new connection factory it will fallback and use the default tcp://localhost:61616 url instead.

      This code

          public static ActiveMQComponent activeMQComponent(String brokerURL) {
              ActiveMQComponent answer = new ActiveMQComponent();
              if (answer.getConfiguration() instanceof ActiveMQConfiguration) {
                  ((ActiveMQConfiguration) answer.getConfiguration())
                          .setBrokerURL(brokerURL);
              }
              return answer;
          }
      

      Should be changed to add a default connection factory as well

          public static ActiveMQComponent activeMQComponent(String brokerURL) {
              ActiveMQComponent answer = new ActiveMQComponent();
              if (answer.getConfiguration() instanceof ActiveMQConfiguration) {
                  ((ActiveMQConfiguration) answer.getConfiguration())
                          .setBrokerURL(brokerURL);
              }
              // set the connection factory with the provided broker url
              answer.setConnectionFactory(ActiveMQConnectionFactory(brokerURL));
              return answer;
          }
      

      I dont have AMQ code checked out and cannot provided a patch. But it should be simple to improve as shown above.

      Attachments

        Activity

          People

            tabish Timothy A. Bish
            davsclaus Claus Ibsen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: