Skip to content

Instantly share code, notes, and snippets.

View nsuthison's full-sized avatar
🤔

Natechawin Suthison nsuthison

🤔
  • Ava Advisor
  • Bangkok
View GitHub Profile
@ElisaBaum
ElisaBaum / Consumer.scala
Last active August 27, 2020 08:06
Kafka Producer/Consumer Example in Scala
import java.util.Properties
import scala.collection.JavaConverters._
import org.apache.kafka.clients.consumer.{ConsumerConfig, ConsumerRecords, KafkaConsumer}
import org.apache.kafka.common.serialization.StringDeserializer
class Consumer(brokers: String, topic: String, groupId: String) {
val consumer = new KafkaConsumer[String, String](configuration)
consumer.subscribe(List(topic).asJava)