I started using StreamInsight and I'm using it as a wcf service. I've already tried seeking help in "A Hitchhiker's Guide to Microsoft StreamInsight Queries" and tried the examples as well as the examples in codeplex.
My problem is this:
My event producer feeds the adapter with AlertEvent's:
public sealed class AlertEvent
{
public DateTime Date { get; set; }
public long IDGroup { get; set; }
public bool IsToNormalize { get; set; }
public bool IsError { get; set; }
}
When a AlertEvent has IsError = false, the flag IsToNormalize is true;
The behaviour that I'm trying to achieve is when I receive a stream with IsError, I want to see if, in the next 'x' minutes, arrives any alertEvent with IsToNormalize. I then send to output the IsError AlarmEvent that started the search.
What I've done is, when I receive a input that correspond to the filter, I extend its lifetime in 'x' minutes and create a TumblingWindow to see if in that period another AlertEvent arrives with the other flag (using a ExtensionMethod to iterate through all payloads in the window).
var stream= from item in input
where item.IsError
group item by item.IdGroup into eachGroup
from window in eachDigital.AlterEventDuration(e => TimeSpan.FromMinutes((double)1.5)).TumblingWindow(TimeSpan.FromSeconds(15), HoppingWindowOutputPolicy.ClipToWindowEnd)
select new
{
Id = eachDigital.Key,
NormEvents = window.HasNormalizationEvents(),
Count = window.Count()
};
Then, to get the AlarmEvent that triggered the TumblingWindow, I've made a join with the original input.
var resultStream = from e1 in stream
join e2 in input
on e1.Id equals e2.DigitalTag
where e1.NormEvents != 0
select e2;
This isn't working at all... :/ Any ideas to help solving this issue?
Another doubt that I have is if there'll be create a new window with a new startDate for each input that passes the filter or will it be created only one tumblingWindow.
Thanks.