The reason is that as the no. of rules in the rulebase grows, it is possible that some of the rule can be re-used/shared for specific purpose.
I am not sure this is the good reason. Of course, like you said, if it can solved by using agenda-group, activation-group, salience. That will be wonderful. Thanks 2011/3/31 Michael Anstis <[email protected]>: > Why would you want to execute a single rule? > > The logic you'd write to determine which rule to fire should itself be part > of the rules: So, for example, if you want to validate facts of type "Smurf" > then write a rule that matches on "Smurf". When you insert a "Smurf" only > the rules that match on this will become candidates for execution when you > call fireAllRules. Perhaps use of a stateless session would simplify things > so you need not worry about other facts in WM "polluting" the results you > expect to see? > > More and more questions are posted here asking how to make individual rules > execute; IMO the solution is to change your thinking about how Rules Engines > work. > > If you give your use-case we might be able to advise a better approach. > > With kind regards, > > Mike > > 2011/3/31 Wolfgang Laun <[email protected]> >> >> >> On 31 March 2011 07:58, Benson Fung <[email protected]> wrote: >>> >>> Hi, >>> >>> If there are 10 rules in the drools rulebase, and right now I would >>> like to execute one of the particular rule. Is there any approach/way >>> to execute particular rule programmatically? >> >> No. The right hand side of a rule (code between "then" and "end") is >> executed whenever there is a set of fact objects in Working Memory >> satisfying the condition. If you insert such a set of facts and call >> fireAllRules(), then it will happen. >> >> >>> >>> I don't think >>> agenda-group or activation-group can do that, right? Or is it >>> possible to create an agenda programmatically ? >> >> No to both. >> -W >> >>> >>> Thanks >>> _______________________________________________ >>> rules-users mailing list >>> [email protected] >>> https://lists.jboss.org/mailman/listinfo/rules-users >> >> >> _______________________________________________ >> rules-users mailing list >> [email protected] >> https://lists.jboss.org/mailman/listinfo/rules-users >> > > > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users > > _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
