我正在尝试返回流口水的会话执行的撤回次数。

我可以获得执行次数:

...
final Command fireAllRulesCmd = CommandFactory.newFireAllRules("executed-rules");
cmds.add(fireAllRulesCmd);
...
session.execute(CommandFactory.newBatchExecution(cmds));
final Integer executedRules = (Integer) execute.getValue("executed-rules");
....


是否有类似的方式来获取所有“缩回规则”?

谢谢!!

问候

最佳答案

实现org.kie.api.event.kiebase.KieBaseEventListener,并在方法afterRuleRemoved中对事件进行计数:

class MyKieBaseEventListener implements KieBaseEventListener {
    private int removedRules;
    public void afterRuleRemoved(AfterRuleRemovedEvent event){
        removedRules++;
    }
    public int getRemovedRules(){
        return removedRules;
    }
    // other methods
}


您必须将此侦听器附加到KieBase。

kieBase.addEventListener( new MyKieBaseEventListener() );

10-08 00:08