Passing message streams from BT to external programs?



    How can I access and pass BT message stream to say another component? I understand that messages remain in a stream unless there is a reason for them to be loaded in the parser. That's why I'm able to successfuly pass almost any type of file thru BizTalk engine provided that I don't need to modify it (which is the case here).

    Now, instead of routing it from Receive via Orchestration to Send Ports I would like to redirect it to say a .NET compnent for processing. Can I do it and if so then how?

    Tuesday, August 05, 2008 4:41 PM


All replies

  • The simplest way would be to write a custom pipeline component and add it to a custom receive pipeline. This would allow you to reference a custom .NET assembly with classes in it. You could also write a custom adapter using the BizTalk adapter framework or WCF LOB SDK or other tools.


    Are you actually trying to pass a stream object of just the text of the message?




    Tuesday, August 05, 2008 5:21 PM
  • What is actually being passed is a ZIP file. We pull it off MQSeries queue (as an alternative somewhere from a file system), we will look at the file name, do our external processing and then finally route that stream to another queue or a file system. Ideally, what we would like to do is to route it to a component, which can efficently deal with byte array (stream). From there we will have a choice, either programmatically connect to the destiantion or use one of existing BizTalk adapters.

    We may want to aggregate few streams into one (for example, there are 10 zip files in a queue and we would like to package them up and send out as a single ZIP file) but the streams themselves will never me modified. "Message" (in this case a ZIP file) comes in as System.Xml.XmlDocument type, which can really be anything (exe, zip, pdf etc) as long as I don't load it into a parser. So let's name it this file FileIn.

    Now, when I instantiate my class (in an orchestration) I can't really say:

    MyClass.MyFunction(FileIN) becasue it will think that this is an actual XmlDocument while it's not. Where to take it from here?

    Tuesday, August 05, 2008 6:10 PM
  • Are you looking for this? From the orchestration you pass in the message into a .NET assembly and in this assembly you use the RetriveAs method to extract the stream of data from the message.



    Thiago Almeida
    Tuesday, August 05, 2008 11:19 PM

    YES! This is almost exactly it. Thank you very much for pointing me in that direction.
    Wednesday, August 06, 2008 1:26 PM