From 62515cf907ec2862aa84a08aa8367c7bb63c098b Mon Sep 17 00:00:00 2001 From: merchoco <29491336@qq.com> Date: Tue, 2 Jul 2019 19:14:33 +0800 Subject: [PATCH] =?UTF-8?q?Comment=20=EF=BC=9A=E5=AE=9E=E4=BE=8Bproducer?= =?UTF-8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=20=E8=AF=B7=E6=B1=82=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E5=92=8C=E5=85=83=E6=95=B0=E6=8D=AE=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=91=A8=E6=9C=9F=20=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/org/example/learn2/producer/ProducerConf.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/learn2/src/main/java/org/example/learn2/producer/ProducerConf.java b/learn2/src/main/java/org/example/learn2/producer/ProducerConf.java index 17838a4..a6691be 100644 --- a/learn2/src/main/java/org/example/learn2/producer/ProducerConf.java +++ b/learn2/src/main/java/org/example/learn2/producer/ProducerConf.java @@ -20,6 +20,10 @@ public static Properties initProperties() { Properties properties = new Properties(); properties.put(org.apache.kafka.clients.producer.ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, url); properties.put(org.apache.kafka.clients.producer.ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); + //请求最大的超时时间 + properties.put("request.timeout.ms", 50); + //元数据更新周期 + properties.put("metadata.max.age.ms", 5000); //自定义拦截器 properties.put(ProducerConfig.INTERCEPTOR_CLASSES_CONFIG, Interceptor.class.getName());