Search code examples
linqbiztalkstreaminsight

StreamInsight 2.1 adapter to observer


I've been trying to implement the following adapter to connect StreamInsight with BizTalk: http://seroter.wordpress.com/2010/07/09/sending-streaminsight-events-to-biztalk-through-new-web-soaprest-adapter/#comment-11635

At the end he does the following to bind the query to the adapter:

var allQuery = callTypeThreshold.ToQuery(
                     myApp,
                     "Threshold Events",
                     string.Empty,
                     typeof(WebOutputFactory),
                     webAdapterBizTalkConfig,
                     EventShape.Point,
                     StreamEventOrder.FullyOrdered);

Now, if I'm not mistaken this doesn't work anymore in StreamInsight 2.1 and I have no clue how to do this. Can anybody help me with this? Thanks in advance!


Solution

  • You can use the legacy adapter model with the newer StreamInsight 2.1 API. To use an input adapter as a source, you'll need to use this overload of Application.DefineStreamable().

    So your code will look something like this:

    var sourceStreamable = Application.DefineStreamable<TPayload>(
    typeof(WebInputFactory),
    webAdapterBizTalkConfig,
    EventShape.Point,
    AdvanceTimeSettings.IncreasingStartTime);
    

    Now, if you want to use an output adapter as a sink, you'll need to use one of the overloads of Application.DefineStreamableSink().

    So that code will look something like this:

    var sink = Application.DefineStreamableSink<TPayload>(
    typeof(WebOutputFactory),
    webAdapterBizTalkConfig,
    EventShape.Point,
    StreamEventOrder.FullyOrdered);
    

    Then just bind your streamable to the sink using the Bind() method followed by Run() to start the process and you are good to go.