This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new ffc84c9bb63 [improve][broker] Log warning on missing URL configuration 
for cluster creation/update (#20541)
ffc84c9bb63 is described below

commit ffc84c9bb630a7bc3b2a46894ccad143d4505d5c
Author: Kim, Joo Hyuk <[email protected]>
AuthorDate: Wed Jun 21 14:15:27 2023 +0900

    [improve][broker] Log warning on missing URL configuration for cluster 
creation/update (#20541)
---
 .../pulsar/common/policies/data/ClusterDataImpl.java   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
 
b/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
index 2ca75245a8c..6a7110e6507 100644
--- 
a/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
+++ 
b/pulsar-common/src/main/java/org/apache/pulsar/common/policies/data/ClusterDataImpl.java
@@ -25,6 +25,8 @@ import java.util.Objects;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.pulsar.client.api.ProxyProtocol;
 import org.apache.pulsar.common.util.URIPreconditions;
 
@@ -38,6 +40,7 @@ import org.apache.pulsar.common.util.URIPreconditions;
 @Data
 @AllArgsConstructor
 @NoArgsConstructor
+@Slf4j
 public final class ClusterDataImpl implements  ClusterData, Cloneable {
     @ApiModelProperty(
             name = "serviceUrl",
@@ -427,5 +430,20 @@ public final class ClusterDataImpl implements  
ClusterData, Cloneable {
                         || Objects.equals(uri.getScheme(), "pulsar+ssl"),
                 "Illegal proxy service url, example: 
pulsar+ssl://ats-proxy.example.com:4443 "
                         + "or pulsar://ats-proxy.example.com:4080");
+
+        warnIfUrlIsNotPresent();
+    }
+
+    private void warnIfUrlIsNotPresent() {
+        if (StringUtils.isEmpty(getServiceUrl()) && 
StringUtils.isEmpty(getServiceUrlTls())) {
+            log.warn("Service url not found, "
+                    + "please provide either service url, example: 
http://pulsar.example.com:8080 "
+                    + "or service tls url, example: 
https://pulsar.example.com:8443";);
+        }
+        if (StringUtils.isEmpty(getBrokerServiceUrl()) && 
StringUtils.isEmpty(getBrokerServiceUrlTls())) {
+            log.warn("Broker service url not found, "
+                    + "please provide either broker service url, example: 
pulsar://pulsar.example.com:6650 "
+                    + "or broker service tls url, example: 
pulsar+ssl://pulsar.example.com:6651.");
+        }
     }
 }

Reply via email to