Below is my idea.
The rule check that there is
1) no event between E1 and E2 and
2) no event after E2
which induce that E1 and E2 are the last 2 event. I think it should work but
I didn't test it.
rule "Props"
when
$E1 : MyEvent(prop1 == "MyProp") from entry-point MyStream
$E2 : MyEvent(prop1 == "MyProp", this after $E1) from entry-point
MyStream
// no event in between $E1 and $E2
not (MyEvent(prop1 == "MyProp", this after $E1, this before $E2)
from entry-point MyStream)
// no event after $E2 ($E2 is the last)
not (MyEvent(prop1 == "MyProp", this after $E2) from entry-point
MyStream)
then
//Do something
end
Best regards.
On Sun, Jan 16, 2011 at 1:26 AM, umesh kumar sain <
umesh.sain(a)alcatel-lucent.com> wrote:
Is there any way to find out last two events with some common properties.
In
my app I'd defined a pojo as drools event whose expiry time is say 5 mins.
Now I want to access the properties of last two events.
say something like this
rule "Props"
when
$E1 : MyEvent(prop1 = "MyProp") from entry-point MyStream
$E2 : MyEvent(prop1 = "MyProp", this != $E1) from entry-point MyStream
then
Do something
end
In the above rule my concern is that since the expiry time is 5 minutes and
I can receive any no of events during this period. How can I be sure that
the above two events $E1 and $E2 are the latest one i.e. last two events
received. I also thought of using sliding window but I don't know when they
are going to be received say 1s, 1m, or 5m.
kindly suggest
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Is-there-any-way-to-f...
Sent from the Drools - User mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users