If I have a point stream with point data from several 'units' identified with a UnitId and Start Date:
var input = CepStream<EventPayload>.Create("input", typeof(SQLPayloadInputAdapterFactory), inputConfig, EventShape.Point);
and I convert it to an interval stream :
var signal = input
.AlterEventDuration(e => TimeSpan.MaxValue)
.ClipEventDuration(input, (e1, e2) => (e1.UnitID == e2.UnitID));
I can get the duration of the events in the signal stream when read by the output adapter as this can see the event object and read its start and end values.
What I need to do is query the 'signal' stream to find the longest event in a 1 min tumbling window
var groupWindowQuery = from e in signal
group e by e.UnitID into unitGroups
from window in unitGroups.TumblingWindow(
TimeSpan.FromSeconds(60),
HoppingWindowOutputPolicy.ClipToWindowEnd)
select new
{
id = unitGroups.Key,
count = window.Count(),
};
... Gives me groups of units with counts etc but i cannot get the duration of the event to pass through to other queries as i can only see payload values in the groupWindowQuery
.
How can i query the event properties to find the longest event in the tumbling window?
Or is it possible to set values in the payload so i could give my point events an end date when creating the signal stream from points?
(doesn't matter that the duration would be 1 min for events that span the window)