Drools看不到规则,因此返回null
我有这样的代码:Drools看不到规则,因此返回null,drools,Drools,我有这样的代码: StatefulKnowledgeSession kSession = getKnowledgeBase().newStatefulKnowledgeSession(); this.insertFactsToWorkingMemory(inputCollection, kSession); kSession.fireAllRules(new NotificationRuleNameFilter(name)); insertFactsToWorkingMemory所做的是它接受
StatefulKnowledgeSession kSession = getKnowledgeBase().newStatefulKnowledgeSession();
this.insertFactsToWorkingMemory(inputCollection, kSession);
kSession.fireAllRules(new NotificationRuleNameFilter(name));
insertFactsToWorkingMemory
所做的是它接受对象属性并简单地执行WorkingMemory.insert(fact)
这些规则存储在.drl
文件中,如下所示:
rule "USER.PASSWORD_RENEW"
when
$config : UserSettings ( )
eval( true )
then
DroolsNotificationResult fact0 = new DroolsNotificationResult();
fact0.setBusinessRulePassed( true );
insert(fact0 );
end
规则的名称和传入的名称
NotificationRuleNameFilter(名称)
完全匹配。有什么线索吗?你是如何建立你的KieBase
?您是否在会话中插入UserSettings
?如果不在fireAllRules()
中使用过滤器,会发生什么情况?添加过滤器是否有助于确定原因<代码>ksession.addEventListener(新的DebugAgendaEventListener())和ksession.addEventListener(新的DebugRuleRuntimeEventListener())代码>