I just upgraded to Drools 4.0 and changed my assertObject calls to insert. I also switched from WorkingMemory to StatefulSession. The rules seem to be fine, but I am not able to retrieve any inserted objects from the working memory for some reason. Here is what I'm doing. I'd appreciate any suggestions...
StatefulSession workingMemory = getActiveWorkingMemories(id);
workingMemory.fireAllRules();
// Here is the rule that fires:
rule
"RecognizeBenefitsProgramEvent"
when $edit: BenefitsProgramModelEdit()
then
insert
(new BenefitsProgramEvent("BenefitsProgramEvent", $edit.getValidFrom(),
"AnnualEnrollmentEvent"));
System.out.println("Rule RecognizeBenefitsProgramEvent fired "
);
endI see the print statement in the console but the inserted object is not actually in the working memory. I look using this:
Iterator events =
workingMemory.iterateObjects(new ClassObjectFilter(BenefitsProgramEvent.class));
This iterator is empty. I also debug and look at the assetMap inside workingMemory and it never changes.
Thanks,
Michael