[rules-users] Behavior change from Drools 3 to Drools 4 for sequential execution

Mark Proctor mproctor at codehaus.org
Mon May 5 10:30:31 EDT 2008


Drools 3.0.x never had a sequentail execution mode. What it had was an 
attribute in the decision table tht would insert and order the salience 
values automatically. The sequential execution mode in 4.0.x is vey 
different and it changes the execution semantics of the engine.
http://downloads.jboss.com/drools/docs/4.0.4.17825.GA/html/ch02s05.html#d0e1249
"after the initial data set no more data can be asserted or modified (no 
rule re-evaluations) and rules cannot be added or removed"

RTFM :)

Mark
mohit churiyal wrote:
> 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
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>   




More information about the rules-users mailing list