Search code examples
esper

Esper - detect event after absence


I found out that it is possible to detect the absence of an event using for example: select * from pattern [every EventX -> (timer:interval(10 sec) and not EventX)], but is it also possible to detect the presence of an event after it was absent? Using prior perhaps? And is it possible to use one statement for detecting both absence and presence? Thanks in advance!


Solution

  • Its sounds like you are looking for this

    every EventX -> (timer:interval(10 sec) and not EventX) -> Event X
    

    ...adding some time interval withing which the event should arrive...

    every EventX -> (timer:interval(10 sec) and not EventX) -> Event X where timer:within(10)
    

    Try an outer join to detect with multiple patterns:

    select * from pattern[...].win:length_batch(1) as pattern1 full outer join pattern[...].win:length_batch(1) as pattern2