We are creating a Flink app using Java where we reading two datastreams from two different kafka topics and using the KeyedCoProcessFunction to find out the records present in one of the streams and missing from the other. We are using two ValueState variables to hold the states from each of the streams. In processElement1 method we are saving the value of the second ValueState variable and checking if it is not null. If it is null, we are updating the first ValueState variable with the object that has been passed as parameter to the processElement1 method and we are registering a timer service to check if the value for the second variable arrives or not. Same way we are implementing in the processElement2 method but here we are checking if the first ValueState variable is null or not and if it is we are updating the second ValueState variable with the object that has been passed as parameter to the processElement2 method and we are registering a timer service to check if the value for the first variable arrives or not.
My question is, is there any order in which the processElement functions get executed? If not, can we control it in any way?