You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi I've Followed the instruction mentioned in the migration guide but seems like the relevance rules are breaking. my question is do we need to change anything in the yaml files as well or this is just a bug in the library ? i've attached Example rule below which is working in version 3 but not in version 4
// Build a rule.Rulerule = newRuleBuilder()
.name("rule name")
.when(newMVELCondition("condition", newParserContext()))// "condition" like "x == 1" or "x >= 10 && x <= 100" or custom by your business.
.then(facts -> facts.put(key, value))// add or update fact's key-value in facts.
.build();
// Fire rules.DefaultRulesEnginerulesEngine = newDefaultRulesEngine();// Only create once in program runtime.Factsfacts = newFacts();
facts.put("x", value);// "x" is define by rule .when() param "condition".rulesEngine.fire(rules, facts);
Objectobj = facts.get(key);
if (obj == null) {
// not fire.
} else {
// fire! obj = value which be define by rule .then().
}
Because of in org.jeasy.rules.mvel.MVELAction.class:
publicvoidexecute(Factsfacts) {
try {
// Facts.asMap() retuen a new Map,but not update facts's fact after MVEL.executeExpression(). That is why you can got a result in version 3.2.0, but null in version 4.1.0. 目前只能使用@Rule注解自定义Rule或通过RuleBuilder生成Rule解决。MVEL.executeExpression(this.compiledExpression, facts.asMap());
} catch (Exceptionvar3) {
LOGGER.error("Unable to evaluate expression: '" + this.expression + "' on facts: " + facts, var3);
throwvar3;
}
}
hi I've Followed the instruction mentioned in the migration guide but seems like the relevance rules are breaking. my question is do we need to change anything in the yaml files as well or this is just a bug in the library ? i've attached Example rule below which is working in version 3 but not in version 4
The text was updated successfully, but these errors were encountered: