Fast, Efficient Message Archiving for BizTalk with the BizTalk Message Archiving Pipeline Component. Download a Free 14-Day Trial!

Custom Disassembler Component – Remember the Context Properties!

This is really a post to remind myself not to be quite so stupid in future….

I’ve been developing a custom pipeline disassembling component over the last few days to take a single purchase order from a customer and split into multiple orders based on (potentially) multiple delivery addresses. The component worked well through the Pipeline.exe tool but on testing using messaging (Send Port subscribing to messages from a Receive Port configured with the new component) I kept receiving:

The "FILE" adapter is suspending a message coming from Source URL:"D:\BizTalk Messages\Inbound\Sales Orders\BAA Sales Orders\Order Splitter Test Input\*.xml". Details:"Could not find a matching subscription for the message. ".

In my wisdom, I’d managed to forget that BizTalk is based on a pub/sub model – if I don’t copy the input message properties onto the resultant output messages and promote the message type, the Send Port might struggle to subscribe…..

So, note to self – copy context properties:

// Iterate through inbound message context properties and add to the new outbound message
for (int i = 0; i < pInMsg.Context.CountProperties; i++)
{
string Name, Namespace;
object PropertyValue = pInMsg.Context.ReadAt(i, out Name, out Namespace);


// If the property has been promoted, respect the settings
if (pInMsg.Context.IsPromoted(Name, Namespace))
outMsg.Context.Promote(Name, Namespace, PropertyValue);
else
outMsg.Context.Write(Name, Namespace, PropertyValue);
}

and promote the message type:

// Promote the MessageType property to ensure subscription by orchestrations
string systemPropertiesNamespace = "http://schemas.microsoft.com/BizTalk/2003/system-properties";
string messageType = "http://www.covast.com/schemas/EDI/Accelerator2004#EDIFACT_ORDERS_D_98A_DEFAULT_UN";
outMsg.Context.Promote("MessageType", systemPropertiesNamespace, messageType);

Doh!

2 Responses to “Custom Disassembler Component – Remember the Context Properties!”


  1. 1 mayur

    Thanks a lot man .. i was searching for this everywhere….

  2. 2 Anonymous

    Thank you !

Leave a Reply





Get Adobe Flash playerPlugin by wpburn.com wordpress themes