import com.poc.events.*;
declare InstigatorEvent
@role(event)
end
declare SomeOtherEvent
@role(event)
end
rule "Rule_1"
when
$instigator_1:InstigatorEvent(userId=="test_244903")
not(SomeOtherEvent(prop=="completedSomething",this after[0s,30s] $instigator_1))
then
System.out.println($instigator_1.getUserId());
end
rule "Rule_2"
when
$instigator_2:InstigatorEvent(userId=="test_244909")
not(SomeOtherEvent(prop=="completedSomething",this after[0s,20s] $instigator_2))
then
System.out.println($instigator_2.getUserId());
end
这是我在小型 POC 中用于特定功能实现的 DRL。
这是我的问题(请原谅我,如果它是由于缺乏理解引起的,因为我是融合新手)....
当我这样做时,
InstigatorEvent event=new InstigatorEvent();
event.setUserId("test_244903");
session.insert(event);
InstigatorEvent event1=new InstigatorEvent();
event1.setUserId("test_244909");
session.insert(event1);
session.fireAllRules();
clock.advanceTime(21, TimeUnit.SECONDS);
clock.advanceTime(20, TimeUnit.SECONDS);
我期待这个输出,
test_244903
test_244909
但我明白了,
test_244909
这是预期的行为吗?我的理解错了吗?有人能告诉我这里到底发生了什么吗?
注意:会话是为“流”模式配置的有状态会话。时钟是一个 SessionPseudoClock。