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