1

I am using PatternTimeoutFunction for discarding the event sequence when it falls out of the defined time window.

I am setting the watermark as follows

public Watermark checkAndGetNextWatermark(Event lastElement, long extractedTimestamp) {
    return new Watermark(extractedTimestamp);
}

When pattern timeout happens, timeoutTimestamp should be equal to first event timestamp + value of timewindow

But timeout is triggering after receiving the next watermark. Is timeout triggered after receiving next watermark or based on timeWindow expiry?

Matthias J. Sax
  • 59,682
  • 7
  • 117
  • 137
ravthiru
  • 8,878
  • 2
  • 43
  • 52

1 Answers1

1

The timeout is triggered by the reception of the watermarks if you use event time. Because you can only be sure to have seen all elements up to a certain point if you receive the watermark for this timestamp.

This means that the timeout timestamp can be larger than the first event timestamp + window length depending on the value of the next watermark. Thus, the timeout timestamp is actually the event time when you realize that your pattern timed out.

Till Rohrmann
  • 13,148
  • 1
  • 25
  • 51
  • Should it trigger timeout if i increase the watermark time as new Watermark(extractedTimestamp + 1) ? – ravthiru Jul 19 '16 at 05:21
  • Depending on what `extractedTimestamp` is. If `extractedTimestamp` is the equal to `timestampOfElement + windowLength - 1`, then it should trigger. – Till Rohrmann Jul 19 '16 at 09:56
  • What i observed is timeout/watermark processing is triggered only after receiving next event. I have tested having only one event, it has to timeout after window length. – ravthiru Jul 25 '16 at 23:43
  • Then you might not have sent a watermark after the first element. Given that a watermark which exceeds the window length arrives after the first element, you should see the pattern timeouts occurring. Could you check this? – Till Rohrmann Aug 01 '16 at 13:45