Uploaded image for project: 'ActiveMQ Artemis'
  1. ActiveMQ Artemis
  2. ARTEMIS-2381

ActiveMQJMSConnectionFactory - Allow to configure brokerURL via setter

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.9.0
    • 2.10.0
    • Broker
    • None

    Description

      When setting up a ConnectionFactory for Artemis via the artemis-client, it would be great if we can configure this via getter/setter style, which allows to configure this nicely via properties such as from application.properties etc.

      In Apache Camel we want to be able to do

      camel.component.jms.connectionFactory=#class:org.apache.activemq.artemis.jms.client.ActiveMQJMSConnectionFactory
      camel.component.jms.connectionFactory.brokerURL=tcp://localhost:61616
      

      Notice how we in the 1st line refer to which class to use (creates via default constructor) and then 2nd line sets the brokerURL, and the following can be used to set other properties such as username and password etc.

      However as setBrokerURL is private we cannot do this

          private void setBrokerURL(String brokerURL) {
              ConnectionFactoryParser cfParser = new ConnectionFactoryParser();
      
              try {
                  URI uri = cfParser.expandURI(brokerURL);
                  this.serverLocator = ServerLocatorImpl.newLocator(uri);
                  cfParser.populateObject(uri, this);
              } catch (Exception var4) {
                  throw new RuntimeException(var4.getMessage(), var4);
              }
      
              if (this.getUser() == null) {
                  this.setUser(DefaultConnectionProperties.DEFAULT_USER);
              }
      
              if (this.getPassword() == null) {
                  this.setPassword(DefaultConnectionProperties.DEFAULT_PASSWORD);
              }
      
          }
      

      Would it be possible to make this method public?

      Attachments

        Issue Links

          Activity

            People

              clebertsuconic Clebert Suconic
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h
                  1h