kafka.javaapi.* 和 org.apache.kafka.* 有什么区别?

what's the difference between kafka.javaapi.* and org.apache.kafka.*?

我是新手 kafka.But 让我困惑的是好像有两个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 实现。

Kafka 0.8.2 Documentation

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 感兴趣,请参阅 Kafka 0.8.1 文档中的 2.1 Producer API