[rules-users] Pattern Example

Wolfgang Laun wolfgang.laun at gmail.com
Tue Sep 25 11:03:23 EDT 2012


On 25/09/2012, thano <asimoon at gmail.com> wrote:
> 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

Apart from some syntactic errors it looks like a pattern but as I
don't know what it should achieve, it's difficult to tell.

Should the rule fire for each RequestCreatedEvent where request
exceeds the 10 days' average? What's the purpose of limiting this to
60s? Simply checking each new RequestCreatedElement (right when it is
entered into the system) would do the trick.

-W

>
>
> 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.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list