Skip to content

Commit

Permalink
Comment :实例producer中增加 请求超时和元数据更新周期 配置
Browse files Browse the repository at this point in the history
  • Loading branch information
nicklyc committed Jul 2, 2019
1 parent d02d022 commit 62515cf
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 62515cf

Please sign in to comment.