Uploaded image for project: 'Red Hat Decision Manager'
  1. Red Hat Decision Manager
  2. RHDM-1387

Rules using binding variables for properties in constraints are evaluated in class reactive.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 7.8.1.GA
    • 7.4.0.GA, 7.7.1.GA
    • BRE
    • None
    • The issue reproduces on 7.4.0 and later, and does not reproduce on 7.3.1 and before.

    • CR1
    • +
    • Hide
      1. Extract reproducer_02679559.zip attached in Attachments.
        $ unzip reproducer_02679559.zip
        
      2. Build the reproducer and execute it.
        $ cd reproducer_02679559
        $ mvn clean install exec:java
        
      3. See the output of the reproducer.
        Expected Result:
        Rule-1 is evaluated only once.
        ***** Action of rule-1
        

        Actual Result:
        Rule-1 is evaluated repeatedly though the number of rules fired is limited by KieSession#fireAllRules(10) in this reproducer.

        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        ***** Action of rule-1
        
      Show
      Extract reproducer_02679559.zip attached in Attachments. $ unzip reproducer_02679559.zip Build the reproducer and execute it. $ cd reproducer_02679559 $ mvn clean install exec:java See the output of the reproducer. Expected Result: Rule-1 is evaluated only once. ***** Action of rule-1 Actual Result: Rule-1 is evaluated repeatedly though the number of rules fired is limited by KieSession#fireAllRules(10) in this reproducer. ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1 ***** Action of rule-1
    • 2020 Week 25-27 (from Jun 15), 2020 Week 31-33 (from Jul 27)

      When we use binding variables for properties of the data object in constraints, it looks like the rule is evaluated not in property reactive but in class reactive. Therefore, for pattern A in the following example rule, rule-1 is unexpectedly evaluated repeatedly. For pattern B or pattern C, the rule is evaluated only once (in property reactive) as expected.

      rule "rule-1"
        when
          /* pattern A -> NG */ $fact: Fact( $property: a, $property == 50 )
          /* pattern B -> OK */ // $fact: Fact( a == 50, $property: a )
          /* pattern C -> OK */ // $fact: Fact( a == 50 )
        then
          System.out.println("***** Action of rule-1");
          modify($fact) {
            setResult("OK")
          }
      end
      

            mfusco@redhat.com Mario Fusco
            rhn-support-myoshida Masato Yoshida
            Daniel Rosa Daniel Rosa
            Daniel Rosa Daniel Rosa
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: