规则
package com.rulesimport entity.Pingdeclare Ping@role(event) // 要把插入的数据声明为event,默认是fact,@expires(20s) // 用来显示设置事件的过期时间,也就是说过了这个时间,该事件就会从会话中移除,不能再使用
endrule "testComplexEvent1"duration 1000when
// eval(true)$p:Ping() over window:time(3s)thenSystem.out.println("rule thread id:"+Thread.currentThread().getId()+"---age---"+$p.getCount());
end
测试类
@Testpublic void duration1() throws Exception{KieServices kss = KieServices.Factory.get();KieContainer kc = kss.getKieClasspathContainer();KieSession ks =kc.newKieSes