[rules-users] please provide a rule for events timeout cases

skatta1986 shivaprasad_gdk at yahoo.co.in
Thu Apr 19 03:04:48 EDT 2012


Hi,

Now time out is working fine. 

But facing issues for correlating success and failure events which doesnot
have unique id. I want to correlate an event request followed by its
immediate event response.

Ex: Consider the events in below order
EventRecord( type=EventRequest, user="katta" ) 
EventRecord( type=EventResponseFailure, user="katta" ) 

EventRecord( type=EventRequest, user="katta" ) 
EventRecord( type=EventResponseSuccess, user="katta" ) 

Rules: 

rule event_success_case 
when 
   $req : EventRecord( type=EventRequest, user="katta" ) 
   and EventRecord( type=EventResponseSuccess, user="katta",  this after[0s,
10s] $req ) 
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 ) 
then 
  System.out.println("Failed case for user " + $req.getUser());
  retract($req);
end

In the above example I don't have any unique identity to correlate request
and response. I need to correlate only based on events order. 


In the above example events order is EventRequest --> EventResponseFailure
and then EventRequest --> EventResponseSuccess. So my expected output is:
Failed case for user katta
Success case for user katta

But I am getting below response:
Success case for user katta
Success case for user katta

First EventRequest and second EventRequest are correlating with second
response EventResponseSuccess as this response is within 0 to 10sec for both
events. 

Note: I am getting expected result only when I send few events. If I insert
around 50 events at time into Working Memory, I face this kind of unexpected
result.

I need to work on live trafic, where I receive hurends of messages per
second.



--
View this message in context: http://drools.46999.n3.nabble.com/please-provide-a-rule-for-events-timeout-cases-tp3907955p3922235.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list