I am effectively trying to simulate processing windows - drop the results that are not complete in time and was trying to use onTimer method in my Processor implementation. I am not sure that I understand exactly how this works. When I start execution (in a different processor) I am executing ctx.timerService.registerEventTimeTimer(currentTime + speculativeTimeout.value()) Basically the absolute cut off time. Is this the right usage? What is happening when I have more then on timer started? |
Hi,
the timers are scoped to the current key when you apply a processing function to a KeyedStream. If you register more than one timer for a particular key and timestamp, you will get only one onTimer callback, see also in docs [1]. Timers registered in a processing function will trigger only in this processing function. All records and timer callbacks are processed sequentially for a particular key in one of parallel instances of the operator. Depending on your use case, if you use event time timer, it might make sense to use current watermark as a ‘currentTime’ in your code snippet. Best, Andrey
|
Thanks Andrey
I do not have event time, dealing only with process time. My process gets 2 types of messages: 1. Start processing, which starts the timer, creates a GUID and outputs event to another stream for the actual processing. Lets say at time 45s and I want to make sure that my result will come back in the next 10s, otherwise I ignore the response. I then start a timer for time 55s 2. Reply that can either come back in time or later. If it is in time (GUID is present), I send the reply back. If GUID is not present I Ignore it onTimer is basically removing GUID that timed out from memory, so that I can ignore the late arrivals Now I can have several start requests for times 45, 50, and 52. If my trout is ten, I have timers for 55, 60 and 62. Will all of them fire at these time intervals assuming that timer’s processing time is 0?
|
Free forum by Nabble | Edit this page |