[rules-users] Re: Drools 4.0 problem: insert (drl) not reflected StatefulSession.

Michael Waluk mwaluk at gmail.com
Thu Aug 16 10:07:22 EDT 2007


The log file also shows that the BenefitsProgramEvent was inserted
properly.  So why wouldn't it appear in the working memory?  Do I need to do
something special or is somehow inserted in another working memory?

Thanks for any suggestions,
Michael

<object-stream>
  <list>
    <org.drools.audit.event.ActivationLogEvent>
      <activationId>RecognizeBenefitsProgramEvent [1]</activationId>
      <rule>RecognizeBenefitsProgramEvent</rule>
      <declarations>$edit=
com.workscape.oba.model.editor.benefits.BenefitsProgramModelEdit at 12d91d5
(1)</declarations>
      <type>6</type>
    </org.drools.audit.event.ActivationLogEvent>
    <org.drools.audit.event.ObjectLogEvent>
      <factId>84</factId>
      <objectToString>
com.workscape.oba.model.events.BenefitsProgramEvent at 9b6713
[]</objectToString>
      <type>1</type>
    </org.drools.audit.event.ObjectLogEvent>
    <org.drools.audit.event.ActivationLogEvent>
      <activationId>RecognizeBenefitsProgramEvent [1]</activationId>
      <rule>RecognizeBenefitsProgramEvent</rule>
      <declarations>$edit=
com.workscape.oba.model.editor.benefits.BenefitsProgramModelEdit at 12d91d5
(1)</declarations>
      <type>7</type>
    </org.drools.audit.event.ActivationLogEvent>
  </list>
</object-stream>




On 8/15/07, Michael Waluk <mwaluk at gmail.com> wrote:
>
> 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 " ); *
> **end*
>
> I 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20070816/c762355b/attachment.html 


More information about the rules-users mailing list