Hi Reza,
You are asking about the order in which @OnTimer and @ProcessElement are called.
I'm not sure about the Dataflow Runner, but in the Flink Runner there is no
strict order between the two, other than the guarantees that apply to window
processing and readiness of timers.
To be able to set the timer in "lower bound" of the window (the minimum
timestamp), you will have to process an element which registers the timer. So
you can't guarantee the timer fires beforehand. If you meant the "upper bound"
(the maximum timestamp), then it can be guaranteed that the timer fires last
because the timer will fire when the watermark is moved to or past the maximum
timestamp.
Generally, elements will be processed as they arrive in the window. Timers are
fired when they are ready. It is best not to make assumptions based on when
elements arrive which belong to the same window. However, you can be sure that
timers fire after they become eligible.
Thanks,
Max
On 14.12.18 10:43, Reza Ardeshir Rokni wrote:
Hi,
I believe a bug in my timeseries code is because of something I missed in the
sequence of OnTimer / ProcessElement when in stream mode.
If a timer has been set at the lower boundary of a window and elements arrive in
that windows keyed state, which will fire first? The @OnTimer or @ProcessElement ?
Cheers
Reza