j-easy / easy-rules

The simple, stupid rules engine for Java
https://github.com/j-easy/easy-rules/wiki
MIT License
4.86k stars 1.05k forks source link

Getting result from yml mvl action #336

Closed soleanos closed 3 years ago

soleanos commented 3 years ago

Hello,

I come to you because i have an issue that i don't know if what i want to do is possible actually with easyrule and if or if it isn't a good practice to do that with a rule engine like this..

I'm actually trying to fire rules like that ( from yml file like you will see, its not a real business case just an exemple for showing what i wants to do in my project) :


name: test single description: A single man doesnt got a wife priority: 1 condition: "' person.wife == null" actions:

(in this exemple Type is an Enum)

The "result " is what i want to obtain after easy rule execution, i want that when a rule fire, a result is returned. In 3.2 version i just had to initialize the fact result with a default value and then my rules changed it and i just had to do re facts.get('myFactName') and i had what i expected but now in 4.X version Fact is final so we cant change a setted value from mvl action.. so my question is : how can i have a result when a rule is checked as true (iv skipOnFirstAppliedRules) ?

In every exemples i saw it's talking about loging semeothing..hello wold.. but never returning a boolean, a String, an object .. I watched the API doc and other github issues and tried some things with listener but i never found a way to get a result as Objet from the action triggered in a mvl yaml file rule. Could you please help me ? Thank you

fmbenhassine commented 3 years ago

This is a duplicate of #295 and #280. Please read the comments in those issues to find more details and examples about your issue.