[ 
https://issues.apache.org/jira/browse/ARTEMIS-4348?focusedWorklogId=869822&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-869822
 ]

ASF GitHub Bot logged work on ARTEMIS-4348:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 07/Jul/23 15:23
            Start Date: 07/Jul/23 15:23
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on code in PR #4539:
URL: https://github.com/apache/activemq-artemis/pull/4539#discussion_r1256001508


##########
artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/ActionAbstract.java:
##########
@@ -113,7 +115,23 @@ public String getBrokerURLInstance(String acceptor) {
                   return new URI(scheme, null, host, port, null, null, 
null).toString();
                }
             }
+
+            for (TransportConfiguration connectorConfiguration: 
brokerConfiguration.getConnectorConfigurations().values()) {
+               if (connectorConfiguration.getName().equals(acceptor)) {
+                  Map<String, Object> acceptorParams = 
connectorConfiguration.getParams();
+                  String scheme = 
ConfigurationHelper.getStringProperty(TransportConstants.SCHEME_PROP_NAME, 
SchemaConstants.TCP, acceptorParams);
+                  String host = 
ConfigurationHelper.getStringProperty(TransportConstants.HOST_PROP_NAME, 
"localhost", acceptorParams);
+                  int port = 
ConfigurationHelper.getIntProperty(TransportConstants.PORT_PROP_NAME, 61616, 
acceptorParams);
+
+                  if (InetAddress.getByName(host).isAnyLocalAddress()) {
+                     host = "localhost";
+                  }
+
+                  return new URI(scheme, null, host, port, null, null, 
null).toString();
+               }
+            }
          } catch (Exception e) {
+            e.printStackTrace();

Review Comment:
   I will actually keep the e.printStackTrace with your suggestion.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 869822)
    Time Spent: 40m  (was: 0.5h)

> CLI Abstract Connector should parse connectors if can't find acceptor on 
> broker.xml
> -----------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-4348
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-4348
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Clebert Suconic
>            Assignee: Clebert Suconic
>            Priority: Major
>             Fix For: 2.30.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> In the advent a broker.xml does not have the acceptor named "artemis" 
> defined, it should try parsing the connector named "artemis" for the default 
> connector URI.
> This is useful in environments where the broker.xml was modified but it still 
> has the default connector.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to