Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Scala is not clear #93

Open
Sammers21 opened this issue Mar 13, 2018 · 0 comments
Open

Documentation for Scala is not clear #93

Sammers21 opened this issue Mar 13, 2018 · 0 comments

Comments

@Sammers21
Copy link

Sammers21 commented Mar 13, 2018

While reading documentation dedicated to scala API http://vertx.io/docs/vertx-kafka-client/scala/ it is assumed that API can be consumed from the dependency:

<dependency>
  <groupId>io.vertx</groupId>
  <artifactId>vertx-kafka-client</artifactId>
  <version>3.5.1</version>
</dependency>

In fact, it can't.

Reproducer:

  1. create a file Hello.scala
import io.vertx.core.Vertx
import io.vertx.kafka.client.consumer.KafkaConsumer

object Hello extends App {

  val vertx = Vertx.vertx()
  var config = Map() +
    ("bootstrap.servers" -> "localhost:9092") +
    ("key.deserializer" -> "org.apache.kafka.common.serialization.StringDeserializer") +
    ("value.deserializer" -> "org.apache.kafka.common.serialization.StringDeserializer") +
    ("group.id" -> "my_group") +
    ("auto.offset.reset" -> "earliest") +
    ("enable.auto.commit" -> "false")

  val consumer = KafkaConsumer.create(vertx, config)
}
  1. Download vertx-core: wget http://central.maven.org/maven2/io/vertx/vertx-core/3.5.1/vertx-core-3.5.1.jar
  2. Download vertx-kafka-client: wget http://central.maven.org/maven2/io/vertx/vertx-kafka-client/3.5.1/vertx-kafka-client-3.5.1.jar
  3. Try to compile the example:
$ scalac -classpath vertx-core-3.5.1.jar:vertx-kafka-client-3.5.1.jar Hello.scala
Hello.scala:15: error: Class org.apache.kafka.clients.consumer.Consumer not found - continuing with a stub.
  val consumer = KafkaConsumer.create(vertx, config)
                 ^
Hello.scala:15: error: overloaded method value create with alternatives:
  [K, V](x$1: io.vertx.core.Vertx, x$2: java.util.Properties)io.vertx.kafka.client.consumer.KafkaConsumer[K,V] <and>
  [K, V](x$1: io.vertx.core.Vertx, x$2: java.util.Map[String,String])io.vertx.kafka.client.consumer.KafkaConsumer[K,V] <and>
  [K, V](x$1: io.vertx.core.Vertx, x$2: org.apache.kafka.clients.consumer.Consumer[K,V])io.vertx.kafka.client.consumer.KafkaConsumer[K,V]
 cannot be applied to (io.vertx.core.Vertx, scala.collection.immutable.Map[String,String])
  val consumer = KafkaConsumer.create(vertx, config)
                               ^
two errors found
 $ scala -version
Scala code runner version 2.12.4 -- Copyright 2002-2017, LAMP/EPFL and Lightbend, Inc.

I wounder i should use vertx-kafka-client-scala_2.12 dependency as well, but it is not even mentioned in the documentation section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant