none
streaminsight v1.2 multiple output adapters

    Question

  • My reading seems to suggest that while I can have multiple input adapters I can have only ONE output adapter. Is this true?

    I only need one query BTW


    Paul Tait

    Monday, May 20, 2013 2:05 AM

All replies

  • maybe not, just try

    http://msdn.microsoft.com/en-us/library/ee378877.aspx

    Tuesday, May 21, 2013 1:47 AM
  • It is possible to add multiple output adapters.

    I use this pattern

    queryBinder.AddFirstOutputAdapter(...)
    primaryQuery = _App.CreateQuery(Name, "CustomLinq Query", queryBinder);
    primaryQuery.Start();
    var newStream = primaryQuery.ToStream<T>();
    var filtered = from e in newStream select e;
    foreach(OutputAdapter action in actions)
    {
       var consumingQuery = 
                        filtered.ToQuery(_App,
                        action.Name,
                        string.Empty,
                        action.GetAdapterFactoryType(),
                        action.GetConfigInfo(),
                        outputEventShape,
                        StreamEventOrder.FullyOrdered);
        consumingQuery.Start();
    }

    Tuesday, May 21, 2013 8:49 AM
  • Yes I've seen that kind of code in examples and thought it was a bit of a hack and may be bad for performance. When we see a linq statement using multiple from statements it "seems efficient where you're code looks like some kind of chaining and therefore double processing. I may be completely wrong but less code always looks more elegant and quite often performs better :-)

    form a in astream

    from b in bstream

    where a.id == b.id

    ...


    Paul Tait

    Tuesday, May 21, 2013 11:05 AM
  • It is a bit of a hack but it's not bad on performance. FarnhamSurrey's method is called Dynamic Query Composition (DQC). The ToStream()/ToQuery() pairing, with no evaluation or subqueries, pushes the event staight through, with very, very little overhead.

    The other thing that you could do is to upgrade to 2.1 ... using multiple sinks with a single stream is pretty simple.


    DevBiker (aka J Sawyer)
    Microsoft MVP - Sql Server (StreamInsight)


    Ruminations of J.net


    If I answered your question, please mark as answer.
    If my post was helpful, please mark as helpful.

    Tuesday, May 21, 2013 2:54 PM