Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I am a new learner of kafka.But what make me confused is that there seems to be two packages of kafka clients.

One is kafka.javaapi.* like

import kafka.javaapi.producer.Producer;
import kafka.producer.KeyedMessage;
import kafka.producer.ProducerConfig;

the other is org.apache.kafka.*. like

import org.apache.kafka.clients.producer.KafkaProducer<K,V>

which is shown is page http://kafka.apache.org/082/javadoc/index.html?org/apache/kafka/clients/producer

I don't know what's their differences.

like image 533
wuchang Avatar asked Mar 27 '15 03:03

wuchang


1 Answers

Before Kafka 0.8.2, kafka.javaapi.producer.Producer was the only official Java client (producer) which is implemented with Scala.

From Kafka 0.8.2, there comes a new Java producer API, org.apache.kafka.clients.producer.KafkaProducer, which is fully implemented with Java.

Kafka 0.8.2 Documentation says

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.

If you are interested in kafka.javaapi.producer.Producer, refer to 2.1 Producer API in Kafka 0.8.1 Documentation.

like image 185
Heejin Avatar answered Oct 02 '22 05:10

Heejin