简体   繁体   English

Kafka Producer 0.8.2.1警告

[英]Kafka Producer 0.8.2.1 warning

I was able to setup a working java Kafka 0.8.2.1 producer. 我能够设置一个可以正常工作的Java Kafka 0.8.2.1生产者。 I need this producer to be async so that it doesn't block the thread. 我需要这个生产者是异步的,以便它不会阻塞线程。 In the console output, I get this warning from the logger: 在控制台输出中,我从记录器收到以下警告:

2016-06-10 10:55:27 WARN  ProducerConfig:121 % The configuration request.timeout.ms = null was supplied but isn't a known config.
2016-06-10 10:55:27 WARN  ProducerConfig:121 % The configuration producer.type = null was supplied but isn't a known config.
2016-06-10 10:55:27 WARN  ProducerConfig:121 % The configuration request.required.acks = null was supplied but isn't a known config.

Can anyone please tell me why I'm getting these warning and how to fix them? 谁能告诉我为什么我收到这些警告以及如何解决它们? My producer config is: 我的生产者配置是:

bootstrap.servers=hostname:9092
client.id=java.net.InetAddress.getLocalHost().getHostName()
compression.type = none
producer.type=async
block.on.buffer.full=false
value.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
key.serializer=org.apache.kafka.common.serialization.StringSerializer
acks=all
request.required.acks=1
retries=2
request.timeout.ms=1200000
batch.size=16384
linger.ms=1
buffer.memory=33554432

Update1: Going through the Kafka Producer code, I do not see 'producer.type' property yet @ http://grepcode.com/file/repo1.maven.org/maven2/org.apache.kafka/kafka-clients/0.8.2.1/org/apache/kafka/clients/producer/KafkaProducer.java?av=f Update1:​​通过Kafka Producer代码,我还没有看到'producer.type'属性@ http://grepcode.com/file/repo1.maven.org/maven2/org.apache.kafka/kafka-clients/0.8 .2.1 /组织/阿帕奇/卡夫卡/客户/制作/ KafkaProducer.java?AV = F

Update2:Does the Kafka Java Producer not have these properties?? Update2:Kafka Java Producer没有这些属性吗? Still stuck here, please can anyone help? 仍然停留在这里,任何人都可以帮助吗?

Ok, so your kafka cluster is up and working correctly and your producer code is giving the error. 好的,因此您的kafka群集已启动并且可以正常工作,并且生产者代码给出了错误。 We will need to see the code of how your producer is being initialized. 我们将需要查看如何初始化生产者的代码。 Typically you create a properties object with the necessary settings and pass that into a kafka.producer.ProducerConfig constructor. 通常,您使用必要的设置创建一个属性对象,并将其传递给kafka.producer.ProducerConfig构造函数。 You can use the settings in producer.properties to start with. 您可以使用producer.properties中的设置开始。

eg 例如

Properties props = new Properties();
props.put("request.timeout.ms", "1200000");
//add more settings to the props object
...
//finally pass in the config to the producer config.
ProducerConfig config = new ProducerConfig(props);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM