views:

30

answers:

1

Hello, I tried to create a custom pipeline component that takes a message and attaches additional another part dynamically (during Disassemble stage). I haven't set up a send port, so that I can see what BizTalk is trying to process. I can see only the body part, the additional part doesn't show up. This is the code I used:

var part = pc.GetMessageFactory().CreateMessagePart();
part.Data = new MemoryStream(new byte[] {1, 2, 3, 4, 5});
inmsg.AddPart("another_part", part, false);

Thank you.

A: 

Most adapters don't look at anything beyond the body part of the message. Exceptions are the web-service related adapters as well as the SMTP one, which can include the extra parts as attachments to the email.

This actually makes sense; for example, what would the file adapter do with multiple parts? Save each one as a separate file?

The reason you see the MIME encoder making a difference is because it explicitly handles multi-part messages by encoding each part into the resulting MIME message.

tomasr
Tomas,Thank you for reply. It looks like my question was not clear. The question was related to a multipart message that was not routed anywhere, and the fact that I didn't see the additional part. A good example of what I was trying to achieve would be ESB exception handling - when a fault message is created, it has an additional part, which is the original message that failed. In BT querying tool, when you query for suspended messages, you can see both parts. That's what I expected to see with my custom multipart message. Mime encoder was only to verify that parts actually existed.
Sean
Oh, sorry, misunderstood you then :) Then yes, you should be seeing it; depending on where the pipeline component is being run. Basically, in certain cases you will see that the message BizTalk shows you might be from before the pipeline is executed.Is this a send or receive pipeline?
tomasr
Thanks Tomas,We are talking about receive pipeline, at the disassemble stage.
Sean
Interesting. Not sure what could be up then; but if the MIME encoder is seeing the extra part, then it should be working just fine. Curious, though; when you're looking at the message in the admin console and don't see the extra part, at what stage in the process did you catch it? As a suspended message? Or did you let it go to a send port that's stopped and looked at it there?
tomasr
Tomas, thank you!I have absolutely no idea what happened, but can see parts now when message is failing to be routed anywhere. Well, I think I actually know what happened - I had to reboot my VM between original post and now, when attempting to see at what stage in processing it failed, just as you suggested.I can definitely see both parts - awesome.Thank you again.
Sean
Here's more interesting material: if no subscription exists at all (ie message failing at routing) then parts DO NOT show. If message is failing at messaging stage, then parts are visible. I had direct binding to inbox, maybe that's the reason? Not sure, but at least I see that it is capable of showing parts. Probably would be easier to send you solution to see what's happening.
Sean
Awesome, glad you could get it working!
tomasr