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
这是预期的行为吗?我的理解错了吗?有人能告诉我这里究竟发生了什么吗?
注意:会话是为“流”模式配置的有状态会话。 clock是SessionPseudoClock。