CEP absence of events using siddhi

412 Views Asked by At

Good afternoon.

I write as an architect SW Competence Centres into Company Indra (www.indra.com).

In this area normally work with CEPs, open-source and commercial, in the open-source domain until now we've always used the Esper CEP, but we have found problems with GPL.

After we've been curious to try Siddhi CEP and for that we have started a project with this CEP.

The problem is that we have found is that we could not identify a feature containing all CEPs and need for the project: detecting absence of events.

In Esper this can be done with a query like:

     select a.id, count (*) from pattern [
     every a = Status -> (timer: interval (10 sec) and not Status (id = a.id)
     ] Group by id

     http://esper.codehaus.org/tutorials/tutorial/tutorial.html

We wanted to know whether the product roadmap is to incorporate this functionality, and if there is now a workaround to this problem.

Thanks and Greetings.

1

There are 1 best solutions below

0
On

This rule will fire every 10 seconds that a newer event does not arrive. Drools CEP Engine must be set to STREAM mode

declare EquipmentFact
@role(event)
@timestamp( lastNotifyTs ) 
originalObject : Object    
equipmentInit : String
equipmentNum : String
   lastNotifyTs : java.util.Date   
   eventTs : java.util.Date
   notifyCnt : int
   maxWait : String
end

rule "Equipment has not been sent within 10 seconds timeframe"

when

$a: EquipmentFact();
not  EquipmentFact(eventTs > $a.eventTs, equipmentInit == $a.equipmentInit, equipmentNum == $a.equipmentNum, this after [1s, 10s] $a)

then

System.out.println("#######  FIRED  ######### Second EquipmentFact event did not arrive 10s " + $a);
retract($a);
    EquipmentFact retE = new EquipmentFact();
retE.setEquipmentInit($a.getEquipmentInit());
retE.setEquipmentNum($a.getEquipmentNum());
retE.setEventTs($a.getEventTs());
retE.setNotifyCnt($a.getNotifyCnt()+1);
retE.setLastNotifyTs(new Date());
insert(retE);

end