Uploaded image for project: 'JBRULES'
  1. JBRULES
  2. JBRULES-2077

update(fact) doesn't work in ruleflow

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

    XMLWordPrintable

Details

    • Workaround Exists
    • Hide

      As a workaround one can do (in a on-exit action):
      drools.getIdentityMap().put(someFact, drools.getWorkingMemory().getFactHandle(someFact));
      and then it is safe to call
      update(someFact);

      Show
      As a workaround one can do (in a on-exit action): drools.getIdentityMap().put(someFact, drools.getWorkingMemory().getFactHandle(someFact)); and then it is safe to call update(someFact);

    Description

      Hi,
      org.drools.base.DefaultKnowledgeHelper uses newly added identityMap to keep track of fact handles. It looks like this identityMap is updated before a rule's consequence is called. However it is not updated before a Drools Flow on-exit action. This means that calling update(someFact) in a on-exit ruleflow action causes exception ("org.drools.FactException: Update error: handle not found for object: XXXXX. Is it in the working memory?").

      this was tested on drools-core-5.0.0.20090417.044049-485.jar

      Thanking you in advance.
      Best Regards,
      Michal

      Attachments

        1. exception.txt
          3 kB
        2. ruleflow.rf
          0.8 kB
        3. RuleFlowTest.java
          2 kB

        Activity

          People

            kverlaen@redhat.com Kris Verlaenen
            michalbali_jira Michal Bali (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Resolved:
              Archived:

              PagerDuty