新增kafka sasl认证机制
This commit is contained in:
@@ -9,10 +9,14 @@ import java.util.Properties;
|
||||
public class KafkaUtils {
|
||||
|
||||
private static Properties getKafkaSinkProperty(){
|
||||
Properties propertiesproducer = new Properties();
|
||||
propertiesproducer.setProperty("bootstrap.servers", CommonConfig.KAFKA_OUTPUT_BOOTSTRAP_SERVERS);
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("bootstrap.servers", CommonConfig.KAFKA_OUTPUT_BOOTSTRAP_SERVERS);
|
||||
properties.setProperty("security.protocol", "SASL_PLAINTEXT");
|
||||
properties.setProperty("sasl.mechanism", "PLAIN");
|
||||
properties.setProperty("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\""+CommonConfig.SASL_JAAS_CONFIG_USER+"\" password=\""+CommonConfig.SASL_JAAS_CONFIG_PASSWORD+"\";");
|
||||
|
||||
return propertiesproducer;
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
public static FlinkKafkaProducer<String> getKafkaSink(String topic){
|
||||
|
||||
Reference in New Issue
Block a user