I am working with Drools in Eclipse, and I have a rule that needs to be triggered in each one of the agendas that I've defined (it is a very important rule).
First, I tried not to set an agenda for that rule, but it only got executed at the end of the last agenda.
So the only thing that came to my mind was defining a rule for each one of the agendas, i.e., the same rule is repeated in all of them, which is not the most efficient solution.
Is this a normal issue? Is there a better solution?
Thanks.
Just did a quick test and it worked fine for me (Drools 7.14.Final) with the following setup :
1) A rule with no agenda-group
2) A rule with agenda-group "Group1"
3) Another rule with agenda-group "Group2"
I called the rules with the following code :
The end-result of the rules called was :
Rule 2)
Rule 1) => end of the first agenda-group call
Rule 3)
Rule 1) again
In this example, my Rule 1) did fire both times so it looks to me like what you're looking for. Do note that I need to use update in my case because my rule condition is on a property that isn't modified by the other rules, so without that update the rule won't fire a second time. Also small caveat, it looks like the "universal" rule will always fire after the current agenda-group. Is it problematic in your case ?