I agree with your point Piotrek, AsyncIO would handle all the pending data for me. However, the reason why I did not want to use it is because in my case, the callbacks are not always called in response of new data being sent to the third party lib. Indeed, the callback will be called rather uncommonly (since in my case it will mean that an anomaly has been detected). This means that If I go with AsyncIO I will need to setup a max timeout for every element, when only a few of them will actuallyinvoke the callback (i.e., produce any data in response). This seems rather drastic because it will probably add too much latency unnecessarily, but I agree on that maybe there is no other way if I need exactly once guarantees.
-- Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/