I am very new to Drools, and started with the basics. Here is a setup;
session.setFocus
)I insert the fact (Here is where I notice the rules within the other agenda group are getting evaluated even though the focus is not on them)
I fireAllRules()
Shouldn't the rules pertaining to the particular agenda group that is in focus be fired and not all rules from all the groups?
It is a fundamental law in many Rule Based Systems - especially those that follow Rete or similar algorithms - that the evaluation of conditions ("t
when", "left hand side") happens whenever there are changes in Working Memory: inserts, updates or deletes. In contrast, rule firing or the execution of consequences ("then", "right hand side") happens after fireAllRules
or fireUntilHalt
has been called.
The firing of rules - more precisely: of activations of rules - can be controlled in several ways. Here, it is indeed the focussed agenda group that limits what can be executed by the engine.
Keep this in mind: evaluation is not equal to execution.