Anyone at all? I still haven't found a way to do this.
Hi Everyone,
I found an old example that shows how to add a rule at runtime:
function void addRule(String pkgName, String rule, RuleBase ruleBase ) {
PackageBuilder builder = new PackageBuilder();
builder.addPackgeFromDrl( new StringReader( rule ) );
ruleBase.addPackage ( builder.addPackage() );
}
I'm trying to do a similar thing with Drools 5 but things seem to have changed. What I want is to add a rule (just as a string) to an already existing set of rules I've loaded from a drl file (the new rule does not have to be saved to the actual file though). I see KnowledgeBase has a remove rule method but no add rule.
I should also note that the set of rules I wish to add to is already executing (as in I've called fireUntilHalt()) I hope this wont make a difference.
Thanks in advance for any help, this mailing list saves me every time!
Cheers,
Justin