locked
Biztalk Server BAM Pipeline Error RRS feed

  • Question

  • Hi,

    I Have recently started Looking into BAM and i have built a Pipeline to write events into BAM(referring few books).This is Execute method below

      public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)
            {
                string SysProps = "http://schemas.microsoft.com/BizTalk/2003/system-properties";
                string interchangeID = pInMsg.Context.Read("InterchangeID", SysProps).ToString();
                string messageID = pInMsg.Context.Read("MessageID", SysProps).ToString();
                string portStartTime = pInMsg.Context.Read("PortStartTime", SysProps).ToString();
                string portEndTime = pInMsg.Context.Read("PortEndTime", SysProps).ToString();
                string messageSize = pInMsg.Context.Read("Size",SysProps).ToString();
                string recievePort = pInMsg.Context.Read("BTS.ReceivePortName", SysProps).ToString();
                string messageType = pInMsg.Context.Read("BTS.MessageType", SysProps).ToString();
                EventStream eventstream = pContext.GetEventStream();
                eventstream.BeginActivity("inbound", interchangeID);
                eventstream.UpdateActivity("inbound", interchangeID,
                    "InterChangeID", interchangeID,
                    "MessageID", messageID,
                    "PortStartTime", portStartTime,
                    "PortEndTime", portEndTime,
                    "Size", messageSize,
                    "BTS.ReceivePortName", recievePort,
                    "BTS.MessageType", messageType);
                eventstream.EndActivity("inbound", interchangeID);
                return pInMsg;

            }

    when i built and Deployed the pipeline,i always get the Error Object reference not set to an instance of an object.

    Can You Please let me know where i have gone wrong and let me know which i need to refer?

    Sunday, February 21, 2016 9:57 AM

Answers

  • The best way to implement this is by using the TPE, where these properties are always available.

    Use it as implemented here: A Happy TPE Story

    I see that you referring to Pro BAM in BizTalk Server 2009 but IMO there has been a change in BizTalk version 2010 and later and these properties like PortStartTime and PortEndTime are not available under the namespace "http://schemas.microsoft.com/BizTalk/2003/system-properties" anymore.

    This has been raised before on the forum as well. Here:- Fetching messaging properties from within a pipeline component

    You can check if you get these properties now under the namespace "http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties" else you have to implement TPE.



    Rachit Sikroria (Microsoft Azure MVP)

    Sunday, February 21, 2016 4:24 PM
    Moderator

All replies

  • IMHO the namespace you're using for PortStartTime, PortEndTime and Size are incorrect. It is the context.Read that is giving you the error. On a side note, why are you writing a custom pipeline component to write to BAM. All these properties are available through TPE for mapping to the BAM activity.

    Regards.

    Sunday, February 21, 2016 11:15 AM
  • The best way to implement this is by using the TPE, where these properties are always available.

    Use it as implemented here: A Happy TPE Story

    I see that you referring to Pro BAM in BizTalk Server 2009 but IMO there has been a change in BizTalk version 2010 and later and these properties like PortStartTime and PortEndTime are not available under the namespace "http://schemas.microsoft.com/BizTalk/2003/system-properties" anymore.

    This has been raised before on the forum as well. Here:- Fetching messaging properties from within a pipeline component

    You can check if you get these properties now under the namespace "http://schemas.microsoft.com/BizTalk/2003/messagetracking-properties" else you have to implement TPE.



    Rachit Sikroria (Microsoft Azure MVP)

    Sunday, February 21, 2016 4:24 PM
    Moderator