I'm trying to build an execution plan which aggregates different events into one and counts the occurrence (CurrentEventId). The plan looks like the following:
define stream inStream (correlation_EventName string, LastEventId int, CurrentEventId int);
partition with (CurrentEventId of inStream)
begin
from inStream#window.timeBatch(10 sec)
select correlation_EventName as meta_Label, CurrentEventId as meta_Id, LastEventId as correlation_From, CurrentEventId as correlation_To, count(CurrentEventId) as correlation_Value
insert into outStream
end;
Actually, I have the following output:
Event: {"event":{"metaData":{"Label":"StartCalculationEvent","Id":2},"correlationData":{"From":2,"To":2,"Value":66}}}
Event: {"event":{"metaData":{"Label":"LoginEvent","Id":1},"correlationData":{"From":1,"To":1,"Value":693}}}
I need just a single event every 10 seconds and not multiple events. This event should have the following format:
[
{
"event":{"metaData":"..."}
},
{
"event":{"metaData":"..."}
}
]
Do you have an idea on how to realize that?