Skip to content

Commit

Permalink
[improve][broker] Log warning on missing URL configuration for cluste…
Browse files Browse the repository at this point in the history
…r creation/update (#20541)
  • Loading branch information
JooHyukKim authored Jun 21, 2023
1 parent 505b449 commit ffc84c9
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
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;

Expand All @@ -38,6 +40,7 @@
@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public final class ClusterDataImpl implements ClusterData, Cloneable {
@ApiModelProperty(
name = "serviceUrl",
Expand Down Expand Up @@ -427,5 +430,20 @@ public void checkPropertiesIfPresent() throws IllegalArgumentException {
|| 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.");
}
}
}

0 comments on commit ffc84c9

Please sign in to comment.