kafka 生产者ProducerRecord key 有什么意义

solo. 发表于: 2016-05-31   最后更新时间: 2021-08-23 23:18:05   29,565 游览

kafka 生产者ProducerRecord key 有什么意义

producer.send(new ProducerRecord<Integer, String>(topic,Key,messageStr)).get();
发表于 2016-05-31

官网的解释是

A key/value pair to be received from Kafka. This consists of a topic name and a partition number, from which the record is being received and an offset that points to the record in a Kafka partition.

kafka0.9客户端都以record为一条消息进行发送,record包含一个键值对,分区topic名。key像map中的key,只是一条record的一个传递属性,未来它将用于去除重复发送的数据。

你的答案

查看kafka相关的其他问题或提一个您自己的问题