nikel
nikel

Reputation: 3564

Kafka Maven Dependencies

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?

Upvotes: 9

Views: 29961

Answers (1)

Martin
Martin

Reputation: 5322

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.

Upvotes: 9

Related Questions