看了下SaslConfigs和CommonClientConfigs,配了如下配置,没有成功。大神有没有demo分享下?
props.put(CommonClientConfigs.DEFAULT_SECURITY_PROTOCOL,"SASL_PLAINTEXT");
props.put( CommonClientConfigs.SECURITY_PROTOCOL_DOC, "KafkaClient {\n" +
"org.apache.kafka.common.security.plain.PlainLoginModule required\n" +
"username=\"kafka\"\n" +
"password=\"kafka-test\";\n" +
"};\n");
props.put(SaslConfigs.DEFAULT_SASL_MECHANISM,"PLAIN");