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

Wolfgang Laun wolfgang.laun at gmail.com
Thu Apr 19 06:12:24 EDT 2012


"Immediate response" is one way of saying that there is no other
response between a request and a response for one user. Simply add
this condition, testing for both kinds of response.

-W

On 19/04/2012, skatta1986 <shivaprasad_gdk at yahoo.co.in> wrote:
> 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.
> _______________________________________________
> 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