I am new to Drools. I am using Drools version 6.2. I have a .drl file which has more than 200 rules and for each request it fires one corresponding rule but it will execute all the rules to check for the evaluation criteria. It is causing the performance issue for me. So I want if any of the rule satisfies the evaluation criteria then the execution for other rules stops.
I have tried to search on that and somewhere I found that the rules are getting executed parallely, but in documentation I have seen in drools 6 the rules got fired sequentially.
Second solution that I tried was using the below code :
final KieSession kSession = RulesLoader
.getStatefulSession(getDrlFileName());
kSession.fireAllRules(1);
But it didn't worked. I have tested it by giving 2 rules same evaluation criteria, but unfortunately both the rules get fired instead of only one.
I am giving the rules format for Reference as given:
rule "Rule 1"
salience 1000
no-loop true
when
eval1
eval2
then
setRequest1
end
rule "Rule 2"
salience 1000
no-loop true
when
eval1
eval2
then
setRequest2
end
So is it possible that we can stop execution of other rules if one rule gets fired? Any help or discussion will be appreciated.
Aucun commentaire:
Enregistrer un commentaire