How to read values from kafka topic using consumer through akka-streams/alpakka-kafka?

Viewed 80

Running with a Consumer.plainSource, nothing happens. Isn't this one way of reading from kafka topic through streams .

val consumerSettings2 = ConsumerSettings(system,new StringDeserializer,new StringDeserializer)
        .withBootstrapServers("localhost:3333")
        .withGroupId("ssss")
        .withProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"earliest")

val source: Source[ConsumerRecord[String, String], Consumer.Control] =
Consumer.plainSource(consumerSettings2, Subscriptions.topics("candy"))

val sink = 
Sink.foreach[ConsumerRecord[String,String]](x=>println("consumed "+x))

source.runWith(sink)
0 Answers
Related