Processing Different Message Types Through The Same Send Port

Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Processing Different Message Types Through The Same Send Port

Viewing 1 reply thread
  • Author
    Posts
    • #18406

      Hello Everyone:

            I have an orchestration that does the following:

      1. Receives 5 different types of ( positional ) flat file schemas using a parrallel convoy i.e. the orchestration does not go ahead until all files are received.
      2. Uses a map to combine all 5 of those flat file message schemas into one request message
      3. Sends the request message to a web service
      4. Receives a response from the web service
      5. If the web service process was successful
      1. move each file ( in its’ original format ) to a processed folder
      • Else
      1. move each file ( in its’ original format ) to an exception folder

      That is the main idea. Instead of creating a “processed” and “failure” send port for each file ( yes, that is 10 ports altogether ), I would like to be able to have two send ports ( which I can later configure as FILE locations in BizTalk Admin ) – one for failure and one for successes – in which I can send any one of my flat file messages through which will then be written to the appropriate directory in its’ native format.

      I understand that I will need my own send pipeline which I have already created. This pipeline has a flat file assembler in it. I also understand that flat file assembler should know which schema it is dealing with.

      The problem is: how do I configure the send port so  that it can receive any one of my different flat file schemas and still be recognizable to the flat file assambler I mentioned?

      Any thoughts or recommendations are appreciated . Thanks! 

      Sincerely,

      Kevin Parkinson 

    • #18410

      With BizTalk Server 2006(and R2) you can call Pipelines inside of your Orchestration.  So you can have a message type of String or Raw String that gets sent out through a Static or Dynamic Send Port.  I have some sample code on how to run a pipeline inside your orchestration here:

       http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2390531&SiteID=1

       

      If you need to go the dynamic port route check this out

      http://geekswithblogs.net/edmundzhao/archive/2006/03/06/71555.aspx

      • #18422

        Thanks Kent! In your first article on MSDN, you state “Here is my code for the Send Pipeline…”. Can you clarify what you mean by that i.e. had you written a custom pipeline component?

         Kevin

        • #18423

          It is a custom pipeline(but not a custom pipeline component).  Basically I have created a pipeline and included my flat file schema as the “document schema”.  Note that you can place more than one flat file schema in 1 pipeline and the pipeline will figure out which message type to assemble.

          • #18424

             Kent:

                  Let’s make sure I am following you here:

            1. You have one or more receive shapes which receives your flat file schema as a message
            2. You a Construct Message shape on your orchestration design surface and insert the folowing code into it:

              msg_Output_FF = new Helper.RawString();
              PipeMsg = new Microsoft.XLANGs.Pipeline.SendPipelineInputMessages();
              PipeMsg.Add(msgX);
              Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteSendPipeline(typeof
              (MyPipelines.SendX),PipeMsg,msg_Output_FF); 

            3. Are you then using the returned RawString ( msg_Output_FF ) to send through a Send Port which expects a RawString? Meaning, I could send any type of message I like though my send port and then configure the port in BizTalk Admin to output the text file to a particular directory?

            Thanks for your help!

            Sincerely,

            Kevin Parkinson 

            • #18430

              Kevin,

               You got it….  Since you are calling the Send Pipelines inside of the orchestration and all of your files are flat files then you can re-use a send port that is sending out messages that are of type “Raw String”.

              Kent

              • #18436

                 Kent:

                     I am almost to the pint where I think I can get this working – after initial trouble with referencing the SendImputPipelineMessages in the orchestration and getting the dreaded ‘unknown exception occured’ message – but there is one thing: the ExecuteSendPipeline method expects an XLangMessage as its’ third paramter, and in your code sample I don’t see you doing any cast or anything. What do you suggest? A Cast? Or?

                 Kevin 

                • #18437

                   Kent:

                      Actually, I understand that the 3rd parameter needs to be of type XLANGMessage. So, the RawString is only an XLANGMessage when you create a message variable of type raw string. I need to pass the message variable in.

                   This is great. I will let you know how it goes when I get it fully implemented.

                   Thanks. 

                  Kevin Parkinson 

                  • #18439

                    That is right, you will need to provide the name of your message as the third parameter which happens to be of type “Raw String”.  Just a word of warning that once a message starts to get up around the 200 mb level that you may start to see .Net Out of Memory exceptions.  Hopefully your messages are not this large.

                    • #18451

                       Kent:

                           Thanks for mentioning that! In fact, some of my messages will be 2MB or more; I have seen ones that are around 4.5MB. In theory though, couldn’t I replace the RawString with the generic System.XmlDocument and stillk have the flat file data in its’ original format outputted to my send location?

                       Thoughts? 

                      Kwvin Parkinson 

                      • #18452

                        No, I don’t think you can.  I believe you will get some additional tags automatically embedded in your message.  They will be <string> tags.  If you are talking about 2 or 4 mb don’t worry about it.  I only started to see problems at 200 mb.

Viewing 1 reply thread
  • The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.