Streaminsight TypedOutput adapter throws an error


  • I get the following error when i use a typedoutputadapter , i dont get any error when i use untypedoutputadapter

    Error: Microsoft.ComplexEventProcessing.ManagementException: The query 'enrichedData' (query template 'enrichedData_Template') could no
    n: Cannot initialize type 'System.Collections.Generic.IEqualityComparer`1[System.String]' because it does not have a default constructo
       at Microsoft.ComplexEventProcessing.Diagnostics.Exceptions.Throw(Exception exception)
       at Microsoft.ComplexEventProcessing.Compiler.CompileNodeOperator.RaiseExceptionIfCannotInstantiateClrObject(TypeService typeService,
       at Microsoft.ComplexEventProcessing.Compiler.CompileNodeExportOperator.OnAlgebrize(CompileContext context, QueryBindingInfo queryBin
       at Microsoft.ComplexEventProcessing.Compiler.CompileNodeOperator.Algebrize(CompileContext context, QueryBindingInfo queryBindingInfo
       at Microsoft.ComplexEventProcessing.Compiler.CompileNodeQueryTemplate.OnAlgebrize(CompileContext context, QueryBindingInfo queryBind
       at Microsoft.ComplexEventProcessing.Compiler.CompileNodeQueryTemplate.Algebrize(CompileContext context, QueryBindingInfo queryBindin
       at Microsoft.ComplexEventProcessing.Compiler.Compiler.CompileQuery(Query query, CompilerSwitches switches)
       at Microsoft.ComplexEventProcessing.Engine.InstanceManager.StartQuery(Query query, Subscription diagnosticScope, Boolean isRehydrati
       at Microsoft.ComplexEventProcessing.Engine.InstanceManager.OnStartQuery(Query query, Subscription diagnosticScope)
       --- End of inner exception stack trace ---

    public class OutputPayLoad
            public PdcTrade Trade { get; set; }
            public PortfolioExposure Exposure { get; set; }

            //public override string ToString()
            //    if (Trade != null && Exposure != null)
            //        return String.Format("Trade:{0}\t Exposure:{1}", Trade.ToString(), Exposure.ToString());
            //    else
            //        return base.ToString();


         var enrichedStream =
                            from trade in tradeStream
                            from pflioReferenceData in referenceSignal
                            where  trade.Portfolio.Trim().ToLower() == pflioReferenceData.PortfolioName.Trim().ToLower()
                            where trade.PortfolioType.Trim().ToLower()== pflioReferenceData.PortfolioType.Trim().ToLower()
                            select new OutputPayLoad

            var q = enrichedStream.ToQuery(cepApp,
                                               "enrichedData", "",
                                               typeof(TypedTracerFactory), outputCfg,
                                               EventShape.Point, StreamEventOrder.FullyOrdered);

    Control never comes to TypedTracerFactory

     public sealed class TypedTracerFactory: ITypedOutputAdapterFactory<TracerConfig>
            public static readonly string APP_NAME = "Adapters.TypedOutputTracer";

            public TypedTracerFactory()
            /// <summary>
            /// Dispose method.
            /// </summary>
            public void Dispose()

            public OutputAdapterBase Create<TPayload>(TracerConfig configInfo, Microsoft.ComplexEventProcessing.EventShape eventShape)
                OutputAdapterBase adapter = null;
                switch (eventShape)
                    case EventShape.Point:
                        adapter = new TypedTracerPointOutputAdapter<TPayload>(configInfo, eventShape);


                return adapter;

    Tuesday, October 15, 2013 5:02 PM

All replies

  • What do you have in your code that implements "System.Collections.Generic.IEqualityComparer`1[System.String]"?

    Under the hood, StreamInsight converts your payload class (OutputPayload) to name value pairs. To do this, StreamInsight reflects over your payload type to build up that mapping. If a portion of your payload does not have a default constructor, it blows up.  What do PdcTrade and PortfolioExposure look like? Do they have default constructors?

    On another note, have you considered doing this with the StreamInsight 2.1 and Rx? The newer Source/Sink model is easier to program against.

    Wednesday, October 16, 2013 1:30 PM
  • This is happening when StreamInsight is re-hydrating your class for the output adapter. If you have an untyped output adapter that works fine, you aren't gaining anything except a slightly nicer API; there's no performance benefit. Keep in mind that your class is only used for the schema in the engine; it's being serialized and deserialized anyway, whether you are using typed or untyped adapters.

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

    Ruminations of

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

    Wednesday, October 16, 2013 8:59 PM
  •   [EventGenerator(typeof(PdcTradeFactory))]
        public class PdcTrade
            public String Portfolio { get; set; }
            public Double AddOnExposure { get; set; }
            public String PortfolioType { get; set; }

    public class PortfolioExposure
            public String PortfolioName { get; set; }
            public Dictionary<String, String> RiskVector { get; set; }
            public String PortfolioType { get; set; }
            public override string ToString()
                return String.Format("{0}\t{1}", PortfolioName, PortfolioType);


    The reason why i wanted to have an TypedOutputAdapter was i wanted to print the risk vector.

    I could add another property that flattens the riskvector and use UnTypedOutputAdapter.

    Thursday, October 17, 2013 9:40 AM
  • The problem is most likely coming from PortfolioExposure.RiskVector. Dictionary<T,T> is not a valid type for a StreamInsight event. You could probably flatten it into delimited string and then manipulate it anyway you want in the output adapter. For more information on creating event payloads, see the MSDN docs here: Creating Event Types.

    Thursday, October 17, 2013 12:39 PM