I need to make some slower external requests in parallel, so Async I/O helps greatly with that. However, I also need to make the requests in a certain order per key. Is that possible with Async I/O?
The documentation[1] talks about preserving the stream order of results, but it doesn't discuss the order of the async requests. I tried to use AsyncDataStream.orderedWait, but the order of async requests seems to be random – the order of calls gets shuffled even if I use AsyncDataStream.orderedWait. If that is by design, would there be any suggestion how to work around that? I was thinking of collecting all events of the same key into a List, so that the async operator gets a list instead of individual events. There are of course some downsides with using a List, so I would rather have something better. In a nutshell my code is: AsyncDataStream.orderedWait(stream.keyBy(key), asyncFunction) The asyncFunction extends RichAsyncFunction. Thanks! [1] https://nightlies.apache.org/flink/flink-docs-master/docs/dev/datastream/operators/asyncio/#order-of-results