[rules-users] Firing Specific rules using KBase and StatefulKnowledgeSession

Vignesh viki.ccc at gmail.com
Thu Sep 9 05:32:24 EDT 2010


Hi,

We are not able to fire specific rules using KBase and
StatefulKnowledgeSession,

//Code snippet

StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ksession.fireAllRules(new RuleNameEndsWithAgendaFilter("test"));

If we use the method directly we are getting the below compile time error,
The method fireAllRules(int) in the type StatefulRuleSession is not
applicable for the arguments (RuleNameEndsWithAgendaFilter)

and when we cast it and used the same by
ksession.fireAllRules((AgendaFilter) new
RuleNameEndsWithAgendaFilter("test")); but getting the below exception,
java.lang.ClassCastException: org.drools.base.RuleNameEndsWithAgendaFilter

Same thing we are able to achieve using RuleBase and WorkingMemory as below,

RuleBase ruleBase = agent.getRuleBase();
WorkingMemory wrkMemory = ruleBase.newStatefulSession();
int i=wrkMemory.fireAllRules(new RuleNameEndsWithAgendaFilter("read")); 

Any pointers on how to use this functionality for firing specific rules
using KBase and StatefulKnowledgeSession, by filtering out rules based on
rule names. Please help in this regard.

Thanks,
Vignesh
-- 
View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Firing-Specific-rules-using-KBase-and-StatefulKnowledgeSession-tp1444889p1444889.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list