I'd like to be able to read Drools memory in such a way that I can detect which condition has matched, even though the rule didn't fire in the end.
Say I have this rule:
rule "MyRule"
when
FirstFact(condition == "str")
SecondFast(anotherCondition > 30)
then
...
end
If I insert only an object "FirstFact" in memory and I call fireAllRules(), the rule will not be fired. But still, I'd like to track down that the first condition of this rule matched.
I understand this is a weird requirement, and it may take some time to develop as it would probably not be straightforward but if there's a way to do it I'm interested.
I was thinking of accessing Drools memory and visit all conditions contained in the Rete tree, but I am not sure if it's a good approach or even possible.
Thanks !
Because of the way RETE works, what you are trying to do is not possible. Please read this other Question to get and idea of a possible solution: Drools 7, event listener to whenever a rule is activated (even if partially matched)
Hope it helps,