我能够设置一个有效的java Kafka 0.8.2.1生产者。我需要这个生成器是异步的,这样它就不会阻塞线程。在控制台输出中,我从记录器中收到此警告:
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.
任何人都可以告诉我为什么我会收到这些警告以及如何解决这些问题? 我的制作人配置是:
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:通过Kafka Producer代码,我没有看到' producer.type'物业@ 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
Update2:Kafka Java Producer不具备这些属性吗?仍然困在这里,请任何人帮忙吗?
答案 0 :(得分:0)
好的,所以你的kafka群集已启动并且正常工作,你的生产者代码正在给出错误。我们需要查看生产者如何初始化的代码。通常,您使用必要的设置创建属性对象,并将其传递给kafka.producer.ProducerConfig构造函数。您可以使用producer.properties中的设置开始。
e.g。
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);