Hi,
We migrated our project from Drools 3 to Drools 4. We
observed a slight change of behavior in execution of
rules in sequential mode. Suppose we have drl file
with two rules. In first rule we find whether customer
is preferred customer or not and in second rule we use
it to set a discount percentage (portion of drl
provided below). In Drools 3 if we use sequential
execution using rulebase.addPackage(pkg,false) then
both the rules get fired (because first rule updates
customer object). But in Drools 4 if we use sequential
execution (using ruleBaseConf.setSequential(true))
then rule "preferred" gets fired but rule "discount"
doesn't. Apparently the update() in first rule does
not take effect. This is not the behavior one would
expect. Is there any configuration by which same
behavior can be achieved for Drools 4 also? I went
through the user guide and tried few things like
setting
ruleBaseConf.setSequentialAgenda(SequentialAgenda.DYNAMIC)
(and SequentialAgenda.SEQUENTIAL too) but nothing
worked.
rule "preferred"
no-loop true
salience 999999
when
customer:Customer()
eval(customer.getMonthlySalary() > 5000)
then
customer.setType(Customer.PREFERRED);
System.out.println("Updated customer type.");
update(customer);
end
rule "discount"
no-loop true
salience 999998
when
customer:Customer()
eval (
customer.getType().equals(Customer.PREFERRED) )
then
customer.setDiscount(20);
System.out.println("Updated discount percentage.");
update(customer);
end
Regards,
Mohit
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ