Is there any way of setting up a fallback action on Drools that would get triggered if no rules were matched?
The use-case would be to execute an action to keep the flow going if the fact didn’t trigger any of the rules.
It depends if you want to govern this from inside the rule base, or from externally as a means of "auditing" the evaluation of the rules following the fact inserts.
You could setup an AgendaEventListener to count how many Rule(s) have fired after insertion and rule evaluation fire methods. I've used similar strategy in another projects to get statistics; in your case, you could define a handle/hook to trigger in case the count is zero.
Internally, you could do analogously in a declarative way with rules listening to their own session, in a given group: at the beginning, a utility fact for "no rules have fired" is inserted by housekeeping-type rule, normal rules are evaluated, a housekeeping-type rule check how many rules have in total fired and if >0
then retract the utility fact, a housekeeping-type rule check if the utility fact is present with the lowest salience to trigger the handle/hook intended.
Hope this helps!