问题
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