I'm looking to replace Esper with Siddhi in my application. The esper statement right now is a "timeout" type pattern, where I need to report back when events of a unique "name" and "type" (just string values I can look for on the incoming events) arrive and depart. I know that the event has arrived when the event first arrives in my firstunique window, and I assume the event departs if I don't see any events of the same name and type in a user-defined timeout value. Here's what my esper statements look like(note that there's a lot more going on in the actual esper, I've just simplified this for the sake of example):
create window events_1.std:firstunique(name, type) as NameEvent
insert into events_1 select * from EventCycle[events]
on pattern [every event1=events_1->(timer:interval(4.0 sec) and not events_1(name=event1.name, type=event1.type))]delete from events_1 where name = event1.name AND type=event1.type
I then select the irstream from events_1 and by getting the incoming and removed events I then get the "arrived" and "departed" events from the window.
For the siddhi, the firstunique window is fairly straightforward (I think?):
from EventCycle#window.firstUnique('name')[ type=='type' ] select name, type insert into NameEvent
but I'm really drawing a blank on how to replace that esper "on pattern" with Siddhi. Can I use a single "from every" statement for this or will I need a different approach with Siddhi?
Any help setting me on the right path here will be appreciated!