-->

Esper - detect absence of a certain event

2019-09-01 18:15发布

问题:

is it possible to detect the absence of a certain event type within a given time window without using any other event types in Esper?

Thanx ;)

回答1:

You can take a look at the solution patterns here for some ideas: http://www.espertech.com/esper/solution-patterns#absence-1

Here is an adapted example of detecting an absence of an event, after it has been fired once:

select * from pattern [every EventX -> (timer:interval(10 sec) and not EventX)];

This will fire only once, if after an EventX is received, no other EventX arrives within 10 seconds...

This example:

select * from pattern [every (timer:interval(10 sec) and not EventX)];

Will fire every 10 seconds if no EventX has been receive during that time (and keep firing like this forever).



回答2:

Outer joins are also a good way to detect the absence of an event.