This is my rule:
rule "Your First Rule"
when
$testRule : TestRule(count >= 100)
then
System.out.println("100 PACKETS!");
end
This is how I create the RuleBase and WorkingMemory:
public void invokeRules(){
RuleBase ruleBase = readRule(); \\creates ruleBase from DRL package
开发者_开发问答 workingMemory = ruleBase.newStatefulSession();
testRule = new TestRule();
factHandle = workingMemory.insert(testRule);
workingMemory.fireAllRules();
}
I have an update section:
workingMemory.update(factHandle, testRule);
I am now getting 1 TestRule fact in WorkingMemory and the rule is creating another instance of TestRule. I am aware that I am instantiating two TestRule facts but only the one in WorkingMemory reacts. Where am I going wrong?!
(Wits End)
Not sure what you mean by "and the rule is creating another instance of TestRule"?
Did you call workingMemory.fileAllRules(); immediately after update?
精彩评论