What's the difference between the below two dependencies? Do i really need the first one to make a consumer or producer app?
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<version>0.8.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.8.2.1</version>
</dependency>
</dependencies>
My Producer works fine with just the first one , but the consumer needs the second one.
I had thought the "kafka-clients" artifact would work for both producer and consumer. But looks like "kafka.consumer.Consumer" comes from the other dependency. Why is there a difference?
Also, why is the first artifact named as kafka_2.9.2? i.e why is a version identifier in the name?
Kafka uses a binary protocol over TCP. The protocol defines all APIs as request response message pairs.
modern-cpp-kafka is a header-only C++ library that uses idiomatic C++ features to provide a safe, efficient, and easy way of producing and consuming Kafka messages.
The Kafka producer is conceptually much simpler than the consumer since it has no need for group coordination. A producer partitioner maps each message to a topic partition, and the producer sends a produce request to the leader of that partition.
The Spring for Apache Kafka (spring-kafka) project applies core Spring concepts to the development of Kafka-based messaging solutions. It provides a "template" as a high-level abstraction for sending messages. It also provides support for Message-driven POJOs with @KafkaListener annotations and a "listener container".
If you want to use the latest producer and consumer API then the correct Maven coordinates are:
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>0.9.0.0</version>
</dependency>
See the API documentation for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With