Sending StreamInsight Events to a Windows Form Dashboard (Code Included)

I get tired of showing Microsoft StreamInsight demos where my (complex) events get emitted to a console.  So, as part of a recent demonstration, I built a simple Windows Form dashboard that receives events and uses the built-in Windows Form Charting Controls to display the results.  In this post, I’ll show you the full solution that I built and provide a link to the download package so that you can run the whole thing yourself.

If you’re not familiar with Microsoft StreamInsight, here’s a quick recap.  StreamInsight is a complex event processing engine that can receive high volumes of data via adapters and pass it through LINQ-authored queries.  The result is real-time intelligence about the pattern of events found in the engine.  You can read more about it on the Microsoft MSDN page for StreamInsight, my own blog posts on it, or pick up a book by a set of good-looking authors.

Assuming you have StreamInsight 1.1 installed (download here) you can execute my solution, which has these Visual Studio projects:


The first project, DataPublisher is my custom StreamInsight adapter that sends “call center” events to the StreamInsight engine.


The CallCenterAdapterPoint.cs class is my actual input adapter that leverages the FakeDataSource.cs class which creates a new CallCenterRequestEventType every 500 milliseconds.  The CallCenterRequestEvenType has its properties (e.g. product, call type) randomly assigned upon creation.

The next VS 2010 project that I’ll highlight is my web service adapter (which I describe in depth in this blog post).


I’m going to use this adapter to send complex events from StreamInsight to my Windows Form.

The next project is my Windows Form project, named EventReceiver.WinUI.


This Windows Form hosts a WCF service that when invoked, updates the Chart control on the main form.


I had to do some fun work with .NET delegates to successfully host a WCF and allow the service to update the chart.  Seems to work ok.

The final project, and meatiest, is the StreamInsightQuery project.  This project starts up an embedded StreamInsight server, and has a set of six queries that you can play with.  The first five are meant to be output to the Tracer (console) adapter.  These queries show how to filter events, create tumbling windows, hopping windows and running totals.  If you set the one line of code here to the query you want and press F5, you can see StreamInsight in action.

//start SI query for queries #1-5
#region Tracer Adapter Query

 var siQuery = query4.ToQuery(myApp, "SI Query", string.Empty, typeof(TracerFactory), tracerConfig, EventShape.Point, StreamEventOrder.FullyOrdered);



Cool.  If you want to try out the Windows Form chart, simply comment out the previous siQuery variable and uncomment out the one that follows.

//start SI query for query #6
 #region Web Adapter Query

var siQuery = query6.ToQuery(myApp, "SI Query", string.Empty, typeof(WebOutputFactory), webAdapterConfig, EventShape.Point, StreamEventOrder.FullyOrdered);


Now, you’ll want to go and manually start up the Windows Form console, click the Start Listening button, and make sure that the status of the service is Open.


We can now press F5 again within VS 2010 and start up our StreamInsight server.  Instead of writing events to the Console, StreamInsight is calling the Web adapter and sending messages to the web service hosted by our Windows Form.  Within a few seconds after starting the StreamInsight server, we should see our “running totals by call center type” complex events drawing on the Chart.


When you’re finished being mildly impressed, you can shut down the StreamInsight server and then Stop Listening on the Windows Form.

So that’s it.  You can download the full source code for this whole demo.  StreamInsight is a pretty cool technology and I hope that by making it easy to try it, I’ve motivated you to give it a whirl.

Author: Richard Seroter

Richard Seroter is Director of Developer Relations and Outbound Product Management at Google Cloud. He’s also an instructor at Pluralsight, a frequent public speaker, the author of multiple books on software design and development, and a former editor plus former 12-time Microsoft MVP for cloud. As Director of Developer Relations and Outbound Product Management, Richard leads an organization of Google Cloud developer advocates, engineers, platform builders, and outbound product managers that help customers find success in their cloud journey. Richard maintains a regularly updated blog on topics of architecture and solution design and can be found on Twitter as @rseroter.

25 thoughts

  1. really good stuff, I seem to be running into issues with the winform app though. I get this as missing CallCenterEvent_To_EventDashboardService.xslt .. is that missing from your zip file?

  2. Also, just a note, you may want to mention this, I had to download the samples from codeplex and build two of them to get your solution to build, the OutputTracer and SimpleFileTextWriter

  3. I have seen that the output adapter send the request using HTTP POST. Why WCF is not used to communicate with the client application?

  4. Hi,
    Great article and technology, thanks.
    I’m more on the database technology stack rather than the visual studio/.NET side, so having a few issues getting this running, wondering if you can assist?
    I too had to download the OutputTracer and SimpleFileTextWriter, all good!
    But I get StreamInsight.Samples.Adapters.OutputTracer; “the type or namespace ‘StreamInsight’ could not be found”, i tried referencing it, but it doesnt show up! I registered the two adapters above using regasm.
    Any help would be much appreciated…..


      1. Hi Richard,
        es installed StreamInsight 1.1 (even went through the repair too, to make sure all ok)
        When you say SI dlls, do you mean in C:\Program Files (x86)\Microsoft StreamInsight 1.1\Bin?

        The StreamInsight.Samples.Adapters.OutputTracer.dll and StreamInsight.Samples.Adapters.SimpleTextFileWriter.dll werent so copied them in there, still no joy!


  5. i installed streaminsight 1.1, don’t see any StreamInsight.Samples.Adapters.OutputTracer.dll anywhere (neither in the bin folder of streaminsight nor in the Package_StreamInsightSolution… please advise

  6. update
    ok, so i only found StreamInsight.Samples.OutputAdapters.Tracer, bu tit doesn’t contain a declaration for TracerKind..

  7. Hello, Stgeve, I have got installed the StreamInsight 1.2 however when I am running the project running into the issue such as

    Error 1 The type or namespace name ‘Adapters’ does not exist in the namespace ‘StreamInsight.Samples’ (are you missing an assembly reference?) C:\Users\Downloads\Package_StreamInsightSolution_v1\Package_StreamInsightSolution\StreamInsightQuery\Program.cs 8 29 StreamInsightQuery

    May be the package is missing one of the class?

  8. Hi Richard, As you mentioned, the latest revision must be missing Adapters class which is causing the compilation errors.. Would it be possible to share? I am excited to see your working solution. Thanks!

    Might be missing following dll – > StreamInsight.Samples.Adapters.OutputTracer.dll

    1. Hey Ken, the latest Codeplex download for StreamInsight samples has the adapters in there. It may be in a different folder, and thus you’ll have to update my project to point to it, but it should be there.

  9. Richard, I am sorry to say but thelatest codeplex sample does not work either.. May be the adapater file is missing in the upload.. Would you try and see if it really works?

  10. Cannot get the example on codeplex to work either – any insight on where to find the StreamInsight.Samples.Adapters.OutputTracer.dll

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.