Tuesday, 2 April 2013

Dynamic Send Port in Pure Messaging

Dynamic send ports do not contain a fixed destination address, only a pipeline. The destination address is determined at run time from a specified property in the message.
We can set Dynamic Send port property inside orchestration inside Expression Shape

MySendPort(Microsoft.XLANGs.BaseTypes.Address) = "http://localhost/testpartner/test.aspx";
MySendPort(Microsoft.XLANGs.BaseTypes.TransportType) = "HTTP";

In case scenario is pure messaging, we can set properties inside receive pipeline.
Set and promote OutboundTransportType and OutboundTransportLocation properties inside receive pipeline

This Article describe how to create custom pipeline component for promote two fields (OutboundTransportType and OutboundTransportLocation)

Step 1: Create Custom Disassembler Component.
  public void Disassemble(IPipelineContext pContext, IBaseMessage pInMsg)
            System.Diagnostics.Trace.WriteLine("Pipeline Disassemble Stage Enter");
            msgPart = pInMsg.BodyPart;
            Stream originalStream = pInMsg.BodyPart.GetOriginalDataStream();
                if (msgPart != null)
                    if (originalStream != null)
                        string stream = string.Empty;
                        // do the disassembling
                        byte[] arrByte = ConvertToByteArray(stream);
                        originalStream = (new MemoryStream(arrByte));
            catch (Exception)
                System.Diagnostics.Trace.WriteLine("Pipeline Disassemble Stage Exception");

            originalStream.Seek(0, SeekOrigin.Begin);
            msgPart.Data = originalStream;
            IBaseMessage outMsg = pInMsg;
            outMsg.BodyPart.Data = originalStream;
            System.Diagnostics.Trace.WriteLine("Pipeline Disassemble Stage Exit");

        public IBaseMessage GetNext(IPipelineContext pContext)
            if (qOutputMsgs.Count > 0)
                IBaseMessage msg = (IBaseMessage)qOutputMsgs.Dequeue();
                return msg;
                return null;

Step 2: Create Custom Pipeline using custom component.

Step 3: Deploy Pipeline,

Step 4: Create Receive Port with custom pipeline.

Step 5: Create Dynamic Send port with filter BTS.ReceivePortname = “ReceivePortName”

No comments:

Post a Comment