1 Reply Latest reply on Mar 18, 2013 1:12 AM by Mahesh Kharat

    Business rule for accumulate function with Number fact using Guvnor

    Mahesh Kharat Newbie

      Hi,

       

      I have written one business rule like following in my drl:

       

      package ruleTest

      import com.test.model.ErrorInfo

       

      declare ErrorInfo

          @role(event)

          @timestamp(errorTimeStamp)

      end

       

      rule "Disk Capacity Threshold Error Rule"

         

          when

                  Number( $totalDiskErrors:intValue,intValue == 5)

                  from accumulate($errorCount: ErrorInfo(errorCode=="00000011") over window:time(60s)

                  from entry-point diskErrorEntryPoint,count($errorCount))

          then

                  System.out.println("Disk Capacity Threshold Error Rule - Has passed");

      end

       

      ErrorInfo is my fact which I have defined it to be of type event. In my application, if many event comes having errorCode field's value as "00000011" & count of those events has reached 5 over a window size of 60s then print statement action should be carried out.This piece of rule is working properly.

       

      Now, I want to achieve same thing using Guvnor wherein I can define my business rule. I tried creating fact Number & business rule for it but some how it is not working. I am not getting any errors also. I have attached images of my business rule & source of it.

       

      So I have following doubts

       

      1. How would I create new fact Number? Is it available in guvnor by default?

      2. How to bind the result of accumulate with this fact Number?

       

       

      If anyone knows about this, please do reply.

      Thanks.

       

      -Mahesh