Say I have a stream of events and I want to be able to count how many of them there are in a time window. I would like to receive notification whenever an event enters the time window and changes the count and the same when an event exits the time window.
The below illustration show what I mean. I'm using a time window of length 4 and I want 3 notifications, one when the first event enters the window, the second when the second event enters and the third when the first event exits the time window.

How do I make a query that does that? What if I also want to group by an event's property?
Here's what I have so far, but it doesn't give me a notification when an event leaves the window: @config(async = 'true') define stream myStream (symbol string, timeStamp long) @info(name = 'query1') from myStream#window.externalTime(timeStamp,10 sec) select symbol, timeStamp, count(timeStamp) as eventCount group by symbol insert into outputStream. This is for SIddhi CEP, but I imagine Esper would be similar.