检测不存在某个事件 [英] Detect absence of a certain event
问题描述
在FlinkCEP的文档中,我发现可以强制使用 notFollowedBy
或 notNext
在其他两个事件之间不发生特定事件.
In the documentation of FlinkCEP, I found that I can enforce that a particular event doesn't occur between two other events using notFollowedBy
or notNext
.
但是,我想知道在X时刻之后是否可以检测到某个事件的缺失.例如,如果事件 A 在10秒内没有跟随另一个事件 A ,则发出警报或执行某些操作.
However, I was wondering If I could detect the absence of a certain event after a time X. For example, if an event A is not followed by another event A within 10 seconds, fire an alert or do something.
是否可以定义一个FlinkCEP模式来捕获这种情况?
Could be possible to define a FlinkCEP pattern to capture that situation?
预先感谢,温贝托
推荐答案
尽管Flink CEP在模式末尾不支持notFollowedBy,但是有一种方法可以利用超时功能来实现.
Although Flink CEP does not support notFollowedBy at the end of a Pattern, there is a way to implement this by exploiting the timeout feature.
Flink培训包括锻炼,其中目标是通过两个小时内的START事件(而不是END事件)来识别出租车.您将找到使用CEP的此练习的解决方案
The Flink training includes an exercise where the objective is to identify taxi rides with a START event that is not followed by an END event within two hours. You'll find a solution to this exercise that uses CEP here.
主要思想是在10秒内定义A的模式,然后定义A,然后捕获超时情况.
The main idea would be to define a Pattern of A followed by A within 10 seconds, and then capture the case where this times out.
这篇关于检测不存在某个事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!