Is there any way that I can get the latest event which satisfies a certain predicate ?
For example, if I write this rule:
rule 1:
when
myObject: MyObject(id == "id1" && name == "name1" && type == "type1")
then
myObject.doSomething();
I want the rule to get fired only if the MyObject
object inserted most recently with the id "id1"
has the given name and type.
Note that at a time, there could be multiple MyObject
's with this id.
In essence, I want to do something like this:
rule 1:
when
myObject: (Get the latest MyObject with its id == "id1") and
( myObject.name == "name1" && myObject.type == "type1") )
then
myObject.doSomething();
I am using Drools 6.2.0.