Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ private static void refreshKafkaMetaData(List<BrokersInfo> targets, Stat stat, S
if (SystemConfigUtils.getBooleanProperty(clusterAlias + ".efak.sasl.enable") || SystemConfigUtils.getBooleanProperty(clusterAlias + ".efak.ssl.enable")) {
String endpoints = JSON.parseObject(data).getString("endpoints");
List<String> endpointsList = JSON.parseArray(endpoints, String.class);
String protocolMap = JSON.parseObject(data).getString("listener_security_protocol_map");
String host = "";
int port = 0;
if (endpointsList.size() > 1) {
Expand All @@ -122,7 +123,12 @@ private static void refreshKafkaMetaData(List<BrokersInfo> targets, Stat stat, S
protocol = KConstants.Kafka.SSL;
}
for (String endpointsStr : endpointsList) {
if (endpointsStr.contains(protocol)) {
String endpointName = endpointsStr.split("://")[0];
String realProtocol = "";
if (!protocolMap.isEmpty()) {
realProtocol = JSON.parseObject(protocolMap).getString(endpointName);
}
if (endpointName.equals(protocol) || realProtocol.equals(protocol)) {
String tmp = endpointsStr.split("//")[1];
host = tmp.split(":")[0];
port = Integer.parseInt(tmp.split(":")[1]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public List<BrokersInfo> getAllBrokersInfo(String clusterAlias) {
if (SystemConfigUtils.getBooleanProperty(clusterAlias + ".efak.sasl.enable") || SystemConfigUtils.getBooleanProperty(clusterAlias + ".efak.ssl.enable")) {
String endpoints = JSON.parseObject(tupleString).getString("endpoints");
List<String> endpointsList = JSON.parseArray(endpoints, String.class);
String protocolMap = JSON.parseObject(tupleString).getString("listener_security_protocol_map");
String host = "";
int port = 0;
if (endpointsList.size() > 1) {
Expand All @@ -265,7 +266,12 @@ public List<BrokersInfo> getAllBrokersInfo(String clusterAlias) {
protocol = Kafka.SSL;
}
for (String endpointsStr : endpointsList) {
if (endpointsStr.contains(protocol)) {
String endpointName = endpointsStr.split("://")[0];
String realProtocol = "";
if (!protocolMap.isEmpty()) {
realProtocol = JSON.parseObject(protocolMap).getString(endpointName);
}
if (endpointName.equals(protocol) || realProtocol.equals(protocol)) {
String tmp = endpointsStr.split("//")[1];
host = tmp.split(":")[0];
port = Integer.parseInt(tmp.split(":")[1]);
Expand Down