@Override
public Map<String, Object> getHintsOnCluster(Cluster cluster, SecurityContext securityContext, Subject subject) {
Map<String, Object> hintClusterMap = new HashMap<>();
try (KafkaMetadataService kms = KafkaMetadataService.newInstance(environmentService, cluster.getId(), securityContext)) {
KafkaTopics topics = kms.getTopicsFromZk();
hintClusterMap.put(FIELD_NAME_TOPIC, topics.list());
fillZookeeperHints(cluster, hintClusterMap);
final Map<KafkaBrokerListeners.Protocol, List<String>> protocolToHostsWithPort =
kms.getKafkaBrokerListeners().getProtocolToHostsWithPort();
hintClusterMap.put(FIELD_NAME_BOOTSTRAP_SERVERS, mapValuesJoiner(protocolToHostsWithPort, ","));
hintClusterMap.put(FIELD_NAME_SECURITY_PROTOCOL, protocolToHostsWithPort.keySet());
hintClusterMap.put(FIELD_NAME_KAFKA_SERVICE_NAME, kms.getKafkaServiceName());
} catch (ServiceNotFoundException e) {
throw new IllegalStateException("Service " + Constants.Kafka.SERVICE_NAME + " in cluster " + cluster.getName() +
" not found but mapping information exists.");
} catch (ServiceConfigurationNotFoundException e) {
} catch (Exception e) {
throw new RuntimeException(e);
}
return hintClusterMap;
}