A RULE FAILURE REPORT

38 views
Skip to first unread message

Shreyansh Soni

unread,
Mar 3, 2023, 3:09:11 AM3/3/23
to Drools Usage
As part of a project I am in, I am supposed to figure out a way to see whether we can report all the rules that were NOT  fired and why they weren't.

A simple example of that would be a customer object that is : 
Gender : Male
Age : 46

When passes through a rule that checks:

Gender =="Female" && Age>40

Fails. 

But the reason is because the Gender values didn't match. I want to be able to report these. Going through Drools documentation I haven't found anything similar. 

I am using DROOLS Api for my Spring Boot application. 

If any one can help me in the right direction, that would be great.
Thanks. 

Amit ninja

unread,
Mar 3, 2023, 3:28:15 AM3/3/23
to drools...@googlegroups.com
You can use the listener.A sample example https://github.com/asheet/rules-not-fired



--
You received this message because you are subscribed to the Google Groups "Drools Usage" group.
To unsubscribe from this group and stop receiving emails from it, send an email to drools-usage...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/drools-usage/569b292a-7811-41cd-8b56-e239a4420d09n%40googlegroups.com.
Message has been deleted
Message has been deleted

Shreyansh Soni

unread,
Mar 6, 2023, 1:49:37 AM3/6/23
to Drools Usage
Hey, 

Thank you for the quick information. This actually solved a lot of problems for me.

Is there something that can pinpoint as to which condition failed , in cases where we have AND(&&) / OR (||) conditions in the rules, as explained in my example?

Thank you again for your time and the answer though. 

Regards 
Shrey.

Toshiya Kobayashi

unread,
Mar 17, 2023, 4:17:40 AM3/17/23
to Drools Usage
Hi,

Unfortunately, there is no feature to report that.

If you want to investigate with a debugger why a condition doesn't match, for example, setting a break point at this line would help.

https://github.com/kiegroup/drools/blob/8.35.0.Final/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java#L119

Regards,
Toshiya

2023年3月6日月曜日 15:49:37 UTC+9 sy.s...@gmail.com:
Reply all
Reply to author
Forward
0 new messages