Drools:使用Session与WorkingMemory触发规则

时间:2012-06-26 10:13:22

标签: drools rule-engine

Drools中这两者有什么区别? 意味着我们可以根据

发布规则

从加载的Rules RulesBase和触发规则创建WorkingMemory,如下所示:

WorkingMemory  workingmemory = rulebase.newWorkingMemory();
workingmemory.fireAllRules();

vs

使用会话(有状态。无状态)来触发显示的规则

KnowledgeBase knowledgebase = createKnowledgeBase();
StatefulKnowledgeSession session = knowledgebase.newStatefulKnowledgeSession();
session.insert(Object);
session.fireRules();

1 个答案:

答案 0 :(得分:4)

使用KnowledgeBAse和 KnowledgeSession,知识-api - .jar。 RuleBase和WorkingMemory是旧版接口,将来会被删除。