drools - Getting the latest event satisfying a condition -


is there way can latest event satisfies predicate ?

for example, if write rule:

rule 1:   when     myobject: myobject(id == "id1" && name == "name1" && type == "type1")       myobject.dosomething(); 

i want rule fired if myobject object inserted id "id1" has given name , type. note @ time, there multiple myobject's id.

in essence, want this:

rule 1:   when     myobject: (get latest myobject id == "id1") ,     ( myobject.name == "name1" && myobject.type == "type1") )       myobject.dosomething(); 

i using drools 6.2.0.

assuming have events, requires

declare myobject   @role( event ) end 

you can write rule:

rule "latest id1-name1-type1" when   myobj: myobject( id == "id1", name == "name1", type == "type1" )   not myobject( after myobj, id == "id1" )    myobj.dosomething(); end 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -