Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-311

Odd rules execution for expired events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 7.0.0.Beta1
    • 5.5.0.Final, 6.0.0.CR5
    • None
    • None

      I have declared two types:

      declare Motion
      @role( event )
      @expires( 5s )
      @timestamp( eventTime )
      eventTime : long
      end

      declare Recording
      end

      and following rules:

      rule "StartRecording"
      when
      Motion()
      not Recording()
      then
      insert(new Recording())
      end

      the problem is that when I put a lot of "Motions", sleep (so "Motions" become expired) and then do fireAllRules(), I got "StartRecording" executed multiple times (and not only once), event though "Recording" is inserted every time.

      Another issue would be when instead of "StartRecording" rule I would have "StopRecording" rule:

      rule "StopRecording"
      when
      $m : Motion()
      $r : Recording()
      then
      System.err.println("Recording: " + $r);
      retract($r);
      end

      then when there is a "Recording" fact inserted and multiple expired "Motions", the rule would be executed multiple times (when "Motions" expire) and $r would be null after the first "StopRecording" rule execution.

            mfusco@redhat.com Mario Fusco
            sopel39 Karol Sobczak (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: