input from WCF service with StreamInsight 1.2

Category: sql server streaminsight


kristofr on Fri, 14 Jun 2013 16:14:24


Is there a sample (for StreamInsight 1.2) where they use a webservice or WCF service as input for the input adapter?



DevBiker on Sat, 15 Jun 2013 13:51:51

The StreamInsight sample adapters for V 2.0 ( have a WCF input adapter.

There aren't any API differences between 1.2 and 2.0 so you can download this, change the references from 2.0 to 1.2 and run them.

kristofr on Mon, 17 Jun 2013 13:07:55

Thanks for the answer.
I have checked the sample but I have a question...

I want to produce the events in my web application where I have my WCF service.
So when there is a call to my WCF service I want to create an event and send it through the CEP.
Instead of creating events in the StreamInsight application like in the sample (ProduceEvents method).
So I think I need to move the ProduceEvents method to the WCF service so that when I call my WCF service method I call the ProduceEvents method to create an event.

Is that correctly or do I forget something?
Because when I debug, it is as if he generate multiple events...

DevBiker on Mon, 17 Jun 2013 19:09:06

Let me see if I understand your application flow.

You have an ASP.NET Web Application that hosts a web service. When there is a call to the web service, you want to create an event in StreamInsight and send it through.

Question: is the web service for anything except to send things to StreamInsight? If it is, then you'll have a second Windows Service that hosts a WCF service for the events. If not - if your web service is only for client to send to StreamInsight, then you can host the WCF service directly from your own StreamInsight-based Windows service. Now ... you may want the additional layer for other reasons (isolation, security, etc.) but that's going to depend on your use cases and requirements.

You do not want to host the StreamInsight process in an ASP.NET application. Period.

kristofr on Tue, 18 Jun 2013 08:06:08

In fact this service is just to send the event to StreamInsight so indeed I can opt to host the WCF service in the StreamInsight application.

So in that case it is the same like in the sample, the only difference is that I need an operation to call with my client when I want to create an event. Because in the sample it will generate the events directly... (new Thread(() => ProduceEvents(inputAddress)).Start();)

So I can place this line in comment and just call an operation that enqueue the incoming event. Correct?

kristofr on Tue, 18 Jun 2013 10:09:41

I changed the sample but there is no output at the method ConsumeEvents in my client.

DevBiker on Tue, 18 Jun 2013 13:45:56

First, I can't download your sample - I the host name doesn't resolve in DNS.

Second, I'm looking at the sample and I don't see anywhere in the WCF Input Adapter sample adapter where it automatically enqueues events. Just take the Input Adapter sample adapter ... not the project hosting it ... and start with that. All you would do is make the calls that are in ProduceEvents() yourself.

kristofr on Tue, 18 Jun 2013 14:00:51

Here you can find my solution

In the solution I just added a console application that create events.
Just the consuming of events are not working...

DevBiker on Tue, 18 Jun 2013 14:38:21

You aren't enqueuing any CTIs. Either enqueue some CTIs from your test client or set the AdvanceTimeSettings for the adapter.