我是kafka的新学习者。让我困惑的是kafka客户端好像有两个包。
其中一个是kafka.javaapi。*类似
import kafka.javaapi.producer.Producer;
import kafka.producer.KeyedMessage;
import kafka.producer.ProducerConfig;
另一个是org.apache.kafka。*。喜欢
import org.apache.kafka.clients.producer.KafkaProducer<K,V>
显示在页面 http://kafka.apache.org/082/javadoc/index.html?org/apache/kafka/clients/producer 中
它们有什么区别?
最佳答案
在 Kafka 0.8.2 之前,kafka.javaapi. Producer.Producer
是唯一使用 Scala 实现的官方 Java 客户端(生产者)。
从 Kafka 0.8.2 开始,出现了一个新的 Java 生产者 API,org.apache.kafka.clients. Producer.KafkaProducer
,它完全用 Java 实现。
We are in the process of rewritting the JVM clients for Kafka. As of 0.8.2 Kafka includes a newly rewritten Java producer. The next release will include an equivalent Java consumer. These new clients are meant to supplant the existing Scala clients, but for compatability they will co-exist for some time. These clients are available in a seperate jar with minimal dependencies, while the old Scala clients remain packaged with the server.
如果您对kafka.javaapi. Producer.Producer感兴趣
,请引用2.1 Producer API在 Kafka 0.8.1 文档中。
关于apache-kafka - kafka.javaapi.* 和 org.apache.kafka.* 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29292598/