[rules-users] Pattern Example

thano asimoon at gmail.com
Tue Sep 25 10:28:04 EDT 2012


Hi, 

I am struggling to understand the concept of patterns. I have the following
code which I would like as a generic threshold pattern. I have been told
that it is not a pattern- thanks 


rule “DD” 
     when 
                # calculate the average requests made over 10 days 
        $service: Service( ) 
        Number ( $ averageRequest : doubleValue ) 
from accumulate 
        ( RequestCompletedEvent (fromService = = $service, 
        $request : request ) over window : time (10d) 
from entry-point RequestStream, 
average ( $request) )   
        
        # check if the requests made in the last 60 seconds are higher than
then the threshold value 

$r : RequestCreatedEvent ( fromService = = $service, 
Request > $averageRequest over 
Window : time (60s) 
from entry-point RequestStream 

     then 
                # do something 
end 



--
View this message in context: http://drools.46999.n3.nabble.com/Pattern-Example-tp4019946.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list