I am just starting with Kafka, it sounds really good for Microservices, but I work essentially in Scala.
I added kafka to my sbt project with this:
libraryDependencies += "org.apache.kafka" %% "kafka" % "2.0.0"
Then I do this:
import org.apache.kafka.clients.producer.{Callback,KafkaProducer, Producer}
...
val producer = new KafkaProducer[String, String](props)
val record = new ProducerRecord[String, String]("my-topic", "key", "value")
val fut = producer.send(record, callBack)
...
My problem here is that I am not getting a Scala Future
when I call producer.send
, it is a Java Future
. I don't know how Java Futures work, and I would prefer to skip that learning curve. This time it is Future, but I mean Java in general.
So I am wondering if there is a full Scala api to work with Kafka. It should normally be the case since Kafka is written in Scala.
From Kafka notable changes in 2.0.0