Java Code Examples for org.apache.kafka.common.security.auth.SecurityProtocol#PLAINTEXT

The following examples show how to use org.apache.kafka.common.security.auth.SecurityProtocol#PLAINTEXT . 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: KafkaAvroPublisher.java    From doctorkafka with Apache License 2.0 6 votes vote down vote up
public KafkaAvroPublisher(String zkUrl, String topic, String statsProducerPropertiesFile) {
  this.destTopic = topic;
  Properties statsProducerProperties = new Properties();
  Map<String, Object> keyValueMap = new HashMap<>();
  try {
    if (statsProducerPropertiesFile != null) {
      statsProducerProperties.load(new FileInputStream(statsProducerPropertiesFile));
      for (String propertyName : statsProducerProperties.stringPropertyNames()) {
        keyValueMap.put(propertyName, statsProducerProperties.get(propertyName));
      }
    }
  } catch (IOException e) {
    LOG.error("Failed to load configuration file {}", statsProducerPropertiesFile, e);
  }
  // set the security protocol based on
  SecurityProtocol securityProtocol = SecurityProtocol.PLAINTEXT;
  if (keyValueMap.containsKey(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG)) {
    String secStr = keyValueMap.get(CommonClientConfigs.SECURITY_PROTOCOL_CONFIG).toString();
    securityProtocol = Enum.valueOf(SecurityProtocol.class, secStr);
  }
  Properties producerProperties = OperatorUtil.createKafkaProducerProperties(zkUrl, securityProtocol);
  for (Map.Entry<String, Object> entry: keyValueMap.entrySet()) {
    producerProperties.put(entry.getKey(), entry.getValue());
  }
  this.kafkaProducer = new KafkaProducer<>(producerProperties);
}
 
Example 2
Source File: DoctorKafkaActionWriter.java    From doctorkafka with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
  CommandLine commandLine = parseCommandLine(args);
  String zkUrl = commandLine.getOptionValue(ZOOKEEPER);
  String topic = commandLine.getOptionValue(TOPIC);
  String message = commandLine.getOptionValue(MESSAGE);

  DoctorKafkaActionReporter actionReporter =
      new DoctorKafkaActionReporter(zkUrl, SecurityProtocol.PLAINTEXT, topic, null);
  actionReporter.sendMessage("testkafka10", message);
}
 
Example 3
Source File: ClusterTestHarness.java    From kareldb with Apache License 2.0 4 votes vote down vote up
protected SecurityProtocol getSecurityProtocol() {
    return SecurityProtocol.PLAINTEXT;
}
 
Example 4
Source File: ClusterTestHarness.java    From kcache with Apache License 2.0 4 votes vote down vote up
protected SecurityProtocol getSecurityProtocol() {
    return SecurityProtocol.PLAINTEXT;
}
 
Example 5
Source File: CCKafkaIntegrationTestHarness.java    From cruise-control with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected SecurityProtocol securityProtocol() {
  return SecurityProtocol.PLAINTEXT;
}
 
Example 6
Source File: DoctorKafkaClusterConfig.java    From doctorkafka with Apache License 2.0 4 votes vote down vote up
public SecurityProtocol getSecurityProtocol() {
  Map<String, String> sslConfigMap = getConsumerConfigurations();
  return sslConfigMap.containsKey(SECURITY_PROTOCOL)
      ?  Enum.valueOf(SecurityProtocol.class, sslConfigMap.get(SECURITY_PROTOCOL)) : SecurityProtocol.PLAINTEXT;

}
 
Example 7
Source File: DoctorKafkaConfig.java    From doctorkafka with Apache License 2.0 4 votes vote down vote up
public SecurityProtocol getBrokerStatsConsumerSecurityProtocol() {
  Map<String, String> sslConfigMap = getBrokerStatsConsumerSslConfigs();
  return sslConfigMap.containsKey(SECURITY_PROTOCOL)
      ?  Enum.valueOf(SecurityProtocol.class, sslConfigMap.get(SECURITY_PROTOCOL)) : SecurityProtocol.PLAINTEXT;
}
 
Example 8
Source File: DoctorKafkaConfig.java    From doctorkafka with Apache License 2.0 4 votes vote down vote up
public SecurityProtocol getActionReportProducerSecurityProtocol() {
  Map<String, String> sslConfigMap = getActionReportProducerSslConfigs();
  return sslConfigMap.containsKey(SECURITY_PROTOCOL)
      ?  Enum.valueOf(SecurityProtocol.class, sslConfigMap.get(SECURITY_PROTOCOL)) : SecurityProtocol.PLAINTEXT;
}
 
Example 9
Source File: AbstractKafkaIntegrationTestHarness.java    From li-apache-kafka-clients with BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected SecurityProtocol securityProtocol() {
  return SecurityProtocol.PLAINTEXT;
}