[rules-users] Business rule for accumulate function with Number fact using Guvnor

mahesh_kharat mahesh.kharat at igate.com
Tue Mar 19 00:30:52 EDT 2013


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 <http://drools.46999.n3.nabble.com/file/n4022861/DiskErrorRule.jpg> 
<http://drools.46999.n3.nabble.com/file/n4022861/DiskErrorRuleSource.jpg> 



--
View this message in context: http://drools.46999.n3.nabble.com/Business-rule-for-accumulate-function-with-Number-fact-using-Guvnor-tp4022861.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list