sijie commented on a change in pull request #9260:
URL: https://github.com/apache/pulsar/pull/9260#discussion_r562126814



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -1316,19 +1323,24 @@ private void startPackagesManagementService() throws 
IOException {
     public static WorkerConfig 
initializeWorkerConfigFromBrokerConfig(ServiceConfiguration brokerConfig,
                                                                       String 
workerConfigFile) throws IOException {
         WorkerConfig workerConfig = WorkerConfig.load(workerConfigFile);
+
+        brokerConfig.getWebServicePort()
+            .map(port -> workerConfig.setWorkerPort(port));
+        brokerConfig.getWebServicePortTls()
+            .map(port -> workerConfig.setWorkerPortTls(port));
+
         // worker talks to local broker
         String hostname = 
ServiceConfigurationUtils.getDefaultOrConfiguredAddress(
             brokerConfig.getAdvertisedAddress());
         workerConfig.setWorkerHostname(hostname);
-        workerConfig.setWorkerPort(brokerConfig.getWebServicePort().get());
         workerConfig.setWorkerId(
             "c-" + brokerConfig.getClusterName()
                 + "-fw-" + hostname
-                + "-" + workerConfig.getWorkerPort());
+                + "-" + (workerConfig.getWorkerPort() != null
+                    ? workerConfig.getWorkerPort() : 
workerConfig.getWorkerPortTls()));

Review comment:
       Sure. can make that change.

##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -1316,19 +1323,24 @@ private void startPackagesManagementService() throws 
IOException {
     public static WorkerConfig 
initializeWorkerConfigFromBrokerConfig(ServiceConfiguration brokerConfig,
                                                                       String 
workerConfigFile) throws IOException {
         WorkerConfig workerConfig = WorkerConfig.load(workerConfigFile);
+
+        brokerConfig.getWebServicePort()
+            .map(port -> workerConfig.setWorkerPort(port));
+        brokerConfig.getWebServicePortTls()
+            .map(port -> workerConfig.setWorkerPortTls(port));
+
         // worker talks to local broker
         String hostname = 
ServiceConfigurationUtils.getDefaultOrConfiguredAddress(
             brokerConfig.getAdvertisedAddress());
         workerConfig.setWorkerHostname(hostname);
-        workerConfig.setWorkerPort(brokerConfig.getWebServicePort().get());
         workerConfig.setWorkerId(
             "c-" + brokerConfig.getClusterName()
                 + "-fw-" + hostname
-                + "-" + workerConfig.getWorkerPort());
+                + "-" + (workerConfig.getWorkerPort() != null
+                    ? workerConfig.getWorkerPort() : 
workerConfig.getWorkerPortTls()));

Review comment:
       Fixed the logic to make it consistent.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to