1

I'm currently working on a BizTalk implementation in which I need to split an incoming message. So far the only examples I've been able to find make use of an envelope schema that would create one message per child node of the incoming message.

However in the message I'm getting, that won't simply suffice. I need to split the message so that all child records with the same identifier becomes one message.

Simplified, the inbound message looks like this:

<Root>
    <Child>
        <ID>1</ID>
    </Child>
    <Child>
        <ID>1</ID>
    </Child>
    <Child>
        <ID>2</ID>
    </Child>
    <Child>
        <ID>2</ID>
    </Child>
</Root>

However obviously with more data than just an ID. What I want is to split this into the same structure, but generate one message per ID, so the result would look like so:

Message 1

<Root>
    <Child>
        <ID>1</ID>
    </Child>
    <Child>
        <ID>1</ID>
    </Child>
</Root>

Message 2

<Root>
    <Child>
        <ID>2</ID>
    </Child>
    <Child>
        <ID>2</ID>
    </Child>
</Root>

In addition to this, I can not be sure that the IDs will follow incrementally, but they might as well be scrambled across the message. Also there's no min or max occurs of an ID; there might be one, there might be 50.

So my question is as follows: How do I solve this in the best possible way? Can I use envelopes for such an "advanced" debatching procedure, do I need to create a custom pipeline component, or are there any other secrets out there? ;)

Thanks in advance!

3 Answers3

2

I think this is beyond what an envelope can do for you. You could do this in a pipeline component.

You would have to create each message you want, then add it to a queue that the pipeline component manages. Access to this queue is then provided through the "GetNext" method of the IDisassemblerComponent interface implemented by your pipeline component. An example of doing such a thing to process the contents of a zip file can be found on CodeProject at http://www.codeproject.com/KB/biztalk/btsunzipdisassembler/UnzipDisassembler_src.zip. Just replace where that code is handling the zip file with your code to process the message

Keep in mind that that is advisable to use streaming when processing your message vs "The DOM". An example of developing a streaming pipeline component can be found at http://www.microsoft.com/en-us/download/details.aspx?id=20375.

brunch
  • 623
  • 1
  • 6
  • 11
  • Thank you for your response! This is what i thought (or feared perhaps) ;) I did start looking into creating a pipeline component for this problem today, and just reading the articles in your links has helped me tremendously to understand custom dissemblers! So far I've only made simple pipeline components that have been working on the message context, so this is going to be quite interesting! – Christoffer Mansfield May 04 '12 at 20:19
0

You might look at message debatching. The orchestration suggestion in that link might be what you're looking for.

Jay
  • 13,803
  • 4
  • 42
  • 69
0

I've done something similar to this with a map using custom XSLT and the [Muenchian Method]: http://www.jenitennison.com/xslt/grouping/muenchian.html

It doesn't debatch, per se, but you can use that along with an envlope schema and either resubmit the message via a loop-back port or execute a receive pipeline from an orchestration to perform the actual debatching.

The Davester
  • 498
  • 3
  • 8