When implementing custom pipeline components, sometimes we might get this error after we hook the component onto the pipeline:The Messaging engine failed to process a message submitted by adapter:FILE...
Details:The published message could not be routed because no subscribers were found
This most likely cuase by some missing content properties we forget to promote after we created a new message and return it to the BizTalk engine. If those missing content properties participated in message routing, then the routing failed and you got above error message.To correct this, we need add following codes in our custom pipeline to ensure every promoted properties in the origional message content is also promoted in newly created message content:
for (int iProp = 0;iProp < originalMsgContext.CountProperties;iProp++)
{
string strName;
string strNSpace;
object val = originalMsgContext.ReadAt(iProp,
out strName, out strNSpace);
// promote properties
if (originalMsgContext.IsPromoted(strName, strNSpace))
newMsg.Context.Promote(strName, strNSpace, val);
else
newMsg.Context.Write(strName, strNSpace, val);
}
string systemPropertiesNamespace = "http://schemas.microsoft.com/BizTalk/2003/system-properties";
string messageType = "http://testDisassmbler.testSchema#Tables";
newMsg.Context.Promote("MessageType", systemPropertiesNamespace, messageType);
return newMsg;