Last active
October 16, 2015 14:00
-
-
Save bibryam/be8f8fb9a1dc31876541 to your computer and use it in GitHub Desktop.
Complex Event Processing Rule to mark errors as critical
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.kie.example.project1; | |
| rule "Mark a request as critical when there are 5 or more in 10 seconds. There should be at most 1 critical per 10 minutes" | |
| when | |
| $requestQualifier: RequestQualifier(processed == false) | |
| Number( intValue >=5 ) from accumulate($r: RequestQualifier( ) over window:time( 10s ),count( $r ) ) | |
| Number( intValue ==0 ) from accumulate($r: RequestQualifier( critical == true) over window:time(10m ),count( $r ) ) | |
| then | |
| modify($requestQualifier) { | |
| setProcessed(true), | |
| setCritical(true); | |
| } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment