[rules-users] Agenda Groups basic question

Rongala, Kanthi Kanthi.Rongala at mscibarra.com
Mon Nov 2 09:54:00 EST 2009


Hi,

I am new to Drools and trying my hands out at Drools 5. I cann't figure out how to use agenda- groups. I have a small drl file with two agenda groups and one rule per agenda-group. This doesn't seem to work. However if I happen to comment out the agenda-group attribute, the results are as expected.

Please let me know what I am missing.

package com.mscibarra.examples.drools.controllers;

import com.mscibarra.examples.drools.domainentities.*;


rule "Detect and Remove Duplicate Shelves"
agenda-group "Phase1"
lock-on-active
dialect "mvel"
when
      $universe : LibraryUniverse()
      $shelf : Shelf() from $universe.shelves
      $shelf2 : Shelf(this != $shelf) from $universe.shelves
then
      System.out.println("Duplicate Shelves found::"+$shelf);
      // without the modify(), drools is not alerted about changes
      // $universe.shelves.remove($shelf);
      /*
      modify($universe) {
            shelves.remove($shelf);
      };
      */

end

rule "Singleton Shelf Detector"
agenda-group "Phase1"
lock-on-active
dialect "mvel"
when
      $universe : LibraryUniverse(shelves.size > 1)
then
      System.out.println("Multiple Shelves found::"+$universe.shelves.size);
End



With Regards,
Kanthi Swaroop Rongala



________________________________
NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20091102/24a7d160/attachment.html 


More information about the rules-users mailing list