From 6a0351df8a679647597b1cabd0c5679b97117ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=88=E5=81=A5?= Date: Tue, 27 Aug 2024 10:32:43 +0800 Subject: [PATCH] =?UTF-8?q?kafka=E6=94=B9=E4=B8=BA=E9=9B=86=E7=BE=A4?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fangjia/service/util/kafka/KafkaProducerUtils.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java b/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java index 83439602a..6056a3003 100644 --- a/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java +++ b/projects/fangjia-service/src/main/java/com/fangjia/service/util/kafka/KafkaProducerUtils.java @@ -19,9 +19,13 @@ public class KafkaProducerUtils implements DisposableBean { public KafkaProducerUtils() { Properties properties = new Properties(); - properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "192.168.0.100:30092"); + properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "192.168.0.89:19092,192.168.0.90:19092,192.168.0.91:19092"); properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); + properties.setProperty("session.timeout.ms", "15000"); + properties.setProperty("sasl.mechanism", "PLAIN"); + properties.setProperty("security.protocol", "SASL_PLAINTEXT"); + properties.setProperty("sasl.jaas.config", "org.apache.kafka.common.security.plain.PlainLoginModule required username=\"admin\" password=\"Goojia123456\";"); this.producer = new KafkaProducer(properties); }