admin管理员组文章数量:1297058
I have a project in Drools 7.0.0 I have been tasked to print the execution of the rules in the order that it has been executed regardless if the payload has passed or not. Is this possible to iterate through the rules as it is executed for StatelessKie Session?
rule "My First Rule"
when
Conditions for first rule
Not routed yet
then
Route to "First".
end
rule "My Second Rule"
when
Conditions for second rule
Not routed yet
then
Route to "Second".
end
rule "My Third Rule"
when
Conditions for third rule
Not routed yet
then
Route to "Third".
end
So for example, I have a payload that does not pass the first and second rule but it passes the third rule. I want to print the order the rules are executed before it even encounters the third rule and when it encounters the third rule.
First -> Second -> Third, Second -> First -> Third, etc..
I know the answer is it will be arbitrary but I need to prove that it is to confirm. Thanks!
I have a project in Drools 7.0.0 I have been tasked to print the execution of the rules in the order that it has been executed regardless if the payload has passed or not. Is this possible to iterate through the rules as it is executed for StatelessKie Session?
rule "My First Rule"
when
Conditions for first rule
Not routed yet
then
Route to "First".
end
rule "My Second Rule"
when
Conditions for second rule
Not routed yet
then
Route to "Second".
end
rule "My Third Rule"
when
Conditions for third rule
Not routed yet
then
Route to "Third".
end
So for example, I have a payload that does not pass the first and second rule but it passes the third rule. I want to print the order the rules are executed before it even encounters the third rule and when it encounters the third rule.
First -> Second -> Third, Second -> First -> Third, etc..
I know the answer is it will be arbitrary but I need to prove that it is to confirm. Thanks!
Share Improve this question edited Feb 11 at 19:01 Betty Ong asked Feb 11 at 19:00 Betty OngBetty Ong 11 bronze badge1 Answer
Reset to default 0In ReteOO/Phreak, the rules are not "evaluated in order" in the typical sense, as rules will be activated and placed into agenda if matching, and rule firing order for those in the agenda depending on salience and other policies.
What you can do is use AgendaEventListener to check which rules have fired, and in which order, for a fireAllRules/fireUntilHalt "evaluation".
More precisely you can use it to see which Rules matches (so placed into the Agenda), which one is Fired, and which matches are taken off of the Agenda because of side-effects/Modify of the Facts by the rule which just fired.
本文标签: Rules Order of Execution for Stateless KieSessionDroolsStack Overflow
版权声明:本文标题:Rules Order of Execution for Stateless KieSession - Drools - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741639954a2389858.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论