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

Sliding windows - Rule is being fired even when LHS is false

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 5.3.0.Beta1
    • drools-core (fusion)

    Description

      I have a rule that accumulate fact into sliding window. When the count get to a certain threshold the rule should be activated. After the window time is over, I expect that the rule will not fired anymore. The counter of the fact is report as 0, but still the rule is being executed.

      drl :

      package com.sample;
      import com.sample.WindowLength.FactTest;

      declare FactTest
      @role( event )
      end

      rule "A500 : test"
      when
      // count devices per tag id
      $counter : Number( intValue >= 2 ) from accumulate (
      $d : FactTest() over window:time(1m), count($d))

      then
      System.out.println("A500: Rule is fired, count = " + $counter + " *********");
      end

      scenario:

      ksession.insert(new FactTest());
      ksession.fireAllRules();
      ksession.insert(new FactTest());
      ksession.fireAllRules();
      ksession.insert(new FactTest());
      ksession.fireAllRules();

      SessionPseudoClock clock = ksession.getSessionClock();
      clock.advanceTime(1, TimeUnit.MINUTES );

      ksession.fireAllRules();

      Result:
      A500: Rule is fired, count = 2 *********
      A500: Rule is fired, count = 3 *********
      A500: Rule is fired, count = 0 *********

      Attachments

        Activity

          People

            mproctor@redhat.com Mark Proctor
            eyal_rahamim eyal rahamim (Inactive)
            Archiver:
            rhn-support-ceverson Clark Everson

            Dates

              Created:
              Updated:
              Archived:

              PagerDuty