easy-rules
easy-rules copied to clipboard
How to add fact in action?
In V3 we were able to add fact in action but it is not working in V4.
e.g in V3
facts = [{isRaining : true}]
Rule rule1 = new MVELRule() .name("Rule 1") .priority(0) .when("isRaining==true") .then("System.out.println(\"It rains, take an umbrella!\");"weather=\"wet\";umbrella=isRaining"");
rules.register(rule1);
rulesEngine.fire(rules, facts);
V3 result fact: [{isRaining : true}, {weather : "wet"}, {umbrella : true}]
V4 result fact: [{isRaining : true}]
for same input and rule.
See FAQ https://github.com/j-easy/easy-rules/wiki/faqs#8-how-to-addassign-new-facts-in-rules-written-in-an-expression-language