我正在尝试编写一个drools规则,以检查来自同一流的两个事件是否发生。我有一个遵从性规则类,它包含逻辑(在工作内存中),以便与来自入口点的事件进行比较。我所需要的只是检测两个事件的发生,例如,我想检测事件A已经发生和B发生之后。我用drools语法编写了这个角色。
$comrule : Comprules ( pattern == "response" , isBefore == false)
Event (task == $comrule.antecedent) from entry-point StoreOne
Event (task == $comrule.consequent) from entry-point StoreOne问题是这种技术不起作用。唯一起作用的就是我写这个的时候
Event (task == $comrule.antecedent) from entry-point StoreOne
not Event (task == $comrule.consequent) from entry-point StoreOne我读了drools文档,但是我找不到任何解决这个问题的方法,任何帮助都会很感激。
发布于 2016-12-02 04:45:05
检查两个事件按正确顺序发生的典型模式如下:
Comprules( pattern == "response", !isBefore, $a: antecedent, $b: consequent )
$one: Event( task == $a ) from entry-point StoreOne
$two: Event( task == $b, this after $one ) from entry-point StoreOne使用not测试是否没有一个事实,这将是$one到达后的情况,而$two仍然不存在。
https://stackoverflow.com/questions/40921930
复制相似问题