为每个kafka消息致电远程REST API
我正在Kafka生产商中读取文件(逐行),并在流中读取每条记录(即每行),而Kafka消费者正在收到此记录。Further我需要将其发送给KAFKA消费者的REST API服务以进行一些处理我的回应将发送给其他话题,依此类推。 我不确定如何使用生产者-Compumer -Chafka API进行操作? 需要帮助
I am reading a file (line by line) in kafka producer and sending each record(i.e per line) across the stream and kafka consumer is receiving this record.Further i need to send it to rest api service from kafka consumer to do some processing and my response would be send to some other topic and so on.
I am not sure how can we do it using producer -consumer kafka api?
Need help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这很简单。这就是您需要与Kafka Consumer Client一起开发Spring Boot应用程序的方式,该应用程序与任何后端REST API集成在一起。
您可以 https://howtodoinjava.com/spring-boot2/resttemplate/spring-resttul-client-client-resttemplate-example/ 作为构建REST API模板的参考),根据REST API请求和响应结构,通过POJO类映射您的请求。
It is pretty simple. This is how you need to develop a Spring Boot Application with KAFKA Consumer Client that integrates with any backend REST API.
You can this https://howtodoinjava.com/spring-boot2/resttemplate/spring-restful-client-resttemplate-example/ as a reference to construct a REST API template and include invokeRestAPIClass(Parameters....), to map your request throuhg POJO Classes based on the REST API request and response structure.