Currently i started using the latest drools engine (9.44.0.Final ) in our project . Previouly i used 7.x version. In my previous version i used the custom java method to enable and disable the rule.same code working when i run it in my IDE ( eclipse). but when i generate the pre compiled version its throwing the error.
status_200.drl :
Rule "Test"
enabled ( ruleMarker.isEnabled(rule.name) )
no-loop true
When
Fact ( A == B )
Then
update ( fact);
ruleMarker.disable(drools.getRule().getName());
End
ruleMarker is defined in the global. the class looks like below.
public class RuleMarker {
private Set<String> disabledRules;
public RuleMarker() {
this.disabledRules = new HashSet<>();
}
public boolean isEnabled(String ruleName) {
System.out.print("rulename " + ruleName);
return !this.disabledRules.contains(ruleName);
}
public void disable(String ruleName) {
this.disabledRules.add(ruleName);
}
}
when i run th mvn clean install - getting following error :
Execution default-build of goal org.kie:kie-maven-plugin:9.44.0.Final:build failed: Unable to create KieModule, Errors Existed: [Message [id=1, kieBase=workflow, level=ERROR, path=com/rules/workflow/tasks/status_200.drl, line=-1, column=0 [ERROR] text=Unable to Analyse Expression (ruleMarker.isEnabled(rule.name)):], Message [id=2, kieBase=workflow, level=ERROR, path=com/rules/workflow/tasks/status_200.drl, line=-1, column=0 [ERROR] text=Method isEnabled on class com.utils.RuleMarker with arguments [class java.lang.Object] is missing]]
Anyone have idea to disable the rule at run in latest version of drools engine.