Call http REST api from Flink using Asynchronous I/O

南楼画角 提交于 2021-01-29 13:42:53

问题


i have to fetch data from Rest API from flink process element in every data fetch from the stream, how can i achive that, i couldnt find enough meterials to call the Rest service asynchronously. please help me with some sample articles.


回答1:


All the job is happening inside the asyncInvoke of the RichAsyncFunction. So, to be able to call REST service, You need to use some async HTTP client (technically it could be a synchronous client but this doesn't make sense). An example of async http client usage can be found here.

So, when You execute the async request all You need to do, is to call resultFuture.complete in Your request handler, so that the result is passed downstream in Flink.



来源:https://stackoverflow.com/questions/61478490/call-http-rest-api-from-flink-using-asynchronous-i-o

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