sqwale
sqwale

Reputation: 575

Kafka and clojure no subscribe method for KafkaConsumer object

Hi i have a very odd issue,

I am unable to call the methon subscribe on a kafkaconsumber object from clojure. Below is my code.

(.subscribe (KafkaConsumer. {"bootstrap.servers" "127.0.0.1:9092"
                           "key.deserializer" "org.apache.kafka.common.serialization.StringDeserializer"
                           "value.deserializer" "org.apache.kafka.common.serialization.StringDeserializer"
                           "partition.assignment.strategy" "roundrobin"
                           "group.id" "clj-kafka.consumer"
                           "auto.offset.reset" "smallest"
                           "auto.commit.enable" "false"}) ["test"]))

The version of kafka i am using as defined in my project.clj is

[org.apache.kafka/kafka_2.10 "0.9.0.1"]

For safe measure I have dumped the exact methods a available for my object and subscribe is one of them meaning it can only be an argument issue ?

https://kafka.apache.org/090/javadoc/index.html?org/apache/kafka/clients/consumer/KafkaConsumer.html this is the documentation i am working with.

Any ideas will be welcome.

Upvotes: 0

Views: 124

Answers (1)

Matthias J. Sax
Matthias J. Sax

Reputation: 62350

In Kafka 0.9.x clients are not longer included in Kafka core module but are contained in an own module kafka-clients.

Thus, you should include [org.apache.kafka/kafka-clients "0.9.0.1"] instead of kafka_2.10.

Btw: In 0.9.x the values for parameter auto.offset.reset should be earliest, latest, or none (instead of 0.8.x values smallest and largest) (see https://kafka.apache.org/090/documentation.html#newconsumerconfigs)

Upvotes: 1

Related Questions