public static KafkaBrokersInfo<String> fromZk( List<String> brokerInfo, Security security, KafkaBrokerListeners kafkaBrokerListeners) throws IOException { return brokerInfo == null ? new KafkaBrokersInfo<>(Collections.<String>emptyList(), security, kafkaBrokerListeners.getProtocolToHostsWithPort()) : new KafkaBrokersInfo<>(brokerInfo, security, kafkaBrokerListeners.getProtocolToHostsWithPort()); }
public KafkaBrokersInfo<HostPort> getBrokerHostPortFromStreamsJson() throws ServiceNotFoundException, ServiceComponentNotFoundException, IOException { return KafkaBrokersInfo.hostPort(kafkaBrokerProcesses, getSecurity(), getKafkaBrokerListeners()); }
public KafkaBrokersInfo<String> getBrokerInfoFromZk() throws ZookeeperClientException, IOException { final String brokerIdsZkPath = kafkaZkConnection.buildZkRootPath(ZK_RELATIVE_PATH_KAFKA_BROKERS_IDS); final List<String> brokerIds = zkCli.getChildren(brokerIdsZkPath); List<String> brokerInfo = null; if (brokerIds != null) { brokerInfo = new ArrayList<>(); for (String bkId : brokerIds) { final byte[] bytes = zkCli.getData(brokerIdsZkPath + "/" + bkId); brokerInfo.add(new String(bytes, "UTF-8")); } } return KafkaBrokersInfo.fromZk(brokerInfo, getSecurity(), getKafkaBrokerListeners()); }
public KafkaBrokersInfo<KafkaBrokersInfo.BrokerId> getBrokerIdsFromZk() throws ZookeeperClientException, IOException { final List<String> brokerIds = zkCli.getChildren(kafkaZkConnection.buildZkRootPath(ZK_RELATIVE_PATH_KAFKA_BROKERS_IDS)); return KafkaBrokersInfo.brokerIds(brokerIds, getSecurity(), getKafkaBrokerListeners()); }
public static KafkaBrokersInfo<KafkaBrokersInfo.BrokerId> brokerIds( List<String> brokerIds, Security security, KafkaBrokerListeners kafkaBrokerListeners) throws IOException { List<KafkaBrokersInfo.BrokerId> brokerIdsType = Collections.emptyList(); if (brokerIds != null) { brokerIdsType = new ArrayList<>(brokerIds.size()); for (String brokerId : brokerIds) { brokerIdsType.add(new KafkaBrokersInfo.BrokerId(brokerId)); } } return new KafkaBrokersInfo<>(brokerIdsType, security, kafkaBrokerListeners.getProtocolToHostsWithPort()); }
public static KafkaBrokersInfo<HostPort> hostPort(Collection<ComponentProcess> componentProcesses, Security security, KafkaBrokerListeners kafkaBrokerListeners) throws IOException { List<HostPort> hostsPorts = componentProcesses.stream() .map(cp -> new HostPort(cp.getHost(), cp.getPort())) .collect(toList()); return new KafkaBrokersInfo<>(hostsPorts, security, kafkaBrokerListeners.getProtocolToHostsWithPort()); }