[rules-users] please provide a rule for events timeout cases
Wolfgang Laun
wolfgang.laun at gmail.com
Thu Apr 19 14:53:49 EDT 2012
With this kind of scenario it helps a lot if you retract a matching
pair (R+S, R+F). (If you need the information for further processing,
create another fact.)
And make sure to use '==' when testing for equality!
rule request_success
when
$req : EventRecord( type == EventRequest, $user: user)
$resp : EventRecord( type == EventResponseSuccess, user==$user,
this after[0s.10s] $req )
not EventRecord( type == EventResponseSuccess || == EventResponseFailure,
user == $user, this before $resp )
then
// success
retract( $req );
retract( $resp );
end
-W
On 19/04/2012, skatta1986 <shivaprasad_gdk at yahoo.co.in> wrote:
> Could you please help out me in this...
>
> modified rules: But it is giving thread exception at runtime
>
> rule event_success_case
> when
> $req : EventRecord( type=EventRequest, user="katta" )
> and $resp : EventRecord( type=EventResponseSuccess, user="katta", this
> after[0s, 10s] $req )
> and ( not (EventRecord( type=EventResponseSuccess, user="katta", this
> after[0s, 10s] $req , this before[0s, 10s] $resp)))
> #and ( not (EventRecord( type=EventResponseSuccess, user="katta", $req
> overlaps this, this overlaps $resp) ))
> then
> System.out.println("Success case for user " + $req.getUser());
> retract($req);
> end
>
> rule event_failure_case
> when
> $req : EventRecord( type=EventRequest, user="katta" )
> and EventRecord( type=EventResponseFailure, user="katta", this
> after[0s, 10s] $req )
> and ( not (EventRecord( type=EventResponseFailure, user="katta", this
> after[0s, 10s] $req , this before[0s, 10s] $resp)))
> #and ( not (EventRecord( type=EventResponseFailure, user="katta", $req
> overlaps this, this overlaps $resp) ))
> then
> System.out.println("Failed case for user " + $req.getUser());
> retract($req);
> end
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-tp3907955p3923831.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