[rules-users] is there any 'followed by' in Drools as we have in esper

Wolfgang Laun wolfgang.laun at gmail.com
Wed Apr 11 07:45:38 EDT 2012


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 at 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-we-have-in-esper-tp3901764p3902131.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