Kafka Consumer in play framework using java

安稳与你 提交于 2020-02-16 10:43:11

问题


I have searched thousands of sites for kafka consumer example in play framework in java language. But not able to find any example. Can anyone provide details on how to write a service which consumes topics produced by kafka continuously.

Thanks


回答1:


Play is a web-framework. The underlying Actor system relies on Akka.

The Akka Kafka API is called Alpakka, so I suspect you are searching in the wrong keywords

To combine both Akka and Play w/ Kafka, you can even use the Lagom Framework


Otherwise, of course you can use plain Java consumer as well, regardless of Play Framework

provide details on how to write a service which consumes topics produced by kafka continuously

KafkaConsumer c = new KafkaConsumer(props);
while (true) {
    ConsumerRecords r = c.poll(1000);
    ...
}


来源:https://stackoverflow.com/questions/60045171/kafka-consumer-in-play-framework-using-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!