August 2017
Beginner to intermediate
278 pages
6h 40m
English
This is the Scala version of the previous program and will work the same as the previous snippet. Kafka allows you to write consumer in many languages including Scala.
import org.apache.kafka.clients.consumer._import org.apache.kafka.common.TopicPartitionimport org.apache.log4j.Loggerimport java.util._object DemoConsumer { private val log: Logger = Logger.getLogger(classOf[DemoConsumer]) @throws[Exception] def main(args: Array[String]) { val topic: String = "test1" val topicList: List[String] = new ArrayList[String] topicList.add(topic) val consumerProperties: Properties = new Properties consumerProperties.put("bootstrap.servers", "10.200.99.197:6667") consumerProperties.put("group.id", "Demo_Group") consumerProperties.put( ...
Read now
Unlock full access