You have 2 EventRecord events with (apart from id) identical
attributes. If they have the same timestamp, they are concurrent and
both satisfy the relations expressed by your condition.
In this situation, using the timestamps Drools adds during insertion
is risky - you aren't analyzing "true" times, i.e., when these events
actually happened.
Adding a sequence number to EventRecord might be one solution.
Alternatives might be possible but require a deeper understanding of
the problem domain.
-W
On 11/04/2012, skatta1986 <shivaprasad_gdk(a)yahoo.co.in> wrote:
Actually I have tried this operator "after", but
doesn't work properly as
the
events are inserted into working memory one by one within fraction of
seconds.
Consider EventRecords EventRecord(name=katta, eventType=REQUEST, id=1),
EventRecord(name=katta, eventType=EVENT_UN_AUTHORIZED, id=1) and
EventRecord(name=katta, eventType=REQUEST, id=2)
Drool:
when
($eventReq : EventRecord(eventType == "EVENT_REQUEST", respRecv ==
"false") from entry-point "AggStream")
and ($sipResp : EventRecord( eventType == "EVENT_UN_AUTHORIZED", name ==
$eventReq.name, id.getCallId()=r1.getId(), respRecv == "false", timeStamp
>=
$eventReq.getTimeStamp(), this after[ 0s, 10s ] $eventReq ) from entry-point
"AggStream")
and ($eventReq2 : EventRecord( eventType == "EVENT_REQUEST", name ==
$eventReq.name, respRecv == "false", timeStamp >= $eventReq.getTimeStamp(),
this after[ 0s, 10s ] $eventReq) from entry-point "AggStream")
then
System.out.println( "++++++ Counter events : unauthorized2 event : "
+ $eventReq.getname()+", $eventReq.getId()="+ $eventReq.getId()+",
$eventReq2.getId()="+ $eventReq2.getId());
This rules give the below output:
++++++ Counter events : unauthorized2 event : katta $sipReq.getId()=1,
$sipReq2.getId()=1
++++++ Counter events : unauthorized2 event : katta $sipReq.getId()=2,
$sipReq2.getId()=2
But Expected output is:
++++++ Counter events : unauthorized2 event : katta $sipReq.getId()=1,
$sipReq2.getId()=2
--
View this message in context:
http://drools.46999.n3.nabble.com/is-there-any-followed-by-in-Drools-as-w...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users