Java Code Examples for org.apache.kafka.common.security.auth.SecurityProtocol#forName()

The following examples show how to use org.apache.kafka.common.security.auth.SecurityProtocol#forName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CCEmbeddedBroker.java    From cruise-control with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void parseConfigs(Map<Object, Object> config) {
  _id = Integer.parseInt((String) config.get(KafkaConfig.BrokerIdProp()));
  _logDir = new File((String) config.get(KafkaConfig.LogDirProp()));

  //bind addresses
  String listenersString = (String) config.get(KafkaConfig.ListenersProp());
  for (String protocolAddr : listenersString.split("\\s*,\\s*")) {
    try {
      URI uri = new URI(protocolAddr.trim());
      SecurityProtocol protocol = SecurityProtocol.forName(uri.getScheme());
      _hosts.put(protocol, uri.getHost());
      _ports.put(protocol, null); //we get the value after boot
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
}
 
Example 2
Source File: EmbeddedBroker.java    From li-apache-kafka-clients with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void parseConfigs(Map<Object, Object> config) {
  id = Integer.parseInt((String) config.get("broker.id"));
  logDir = new File((String) config.get("log.dir"));

  //bind addresses
  String listenersString = (String) config.get("listeners");
  for (String protocolAddr : listenersString.split("\\s*,\\s*")) {
    try {
      URI uri = new URI(protocolAddr.trim());
      SecurityProtocol protocol = SecurityProtocol.forName(uri.getScheme());
      hosts.put(protocol, uri.getHost());
      ports.put(protocol, null); //we get the value after boot
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
}