BizTalk 2013 - BTS.MessageID and outMsg.MessageID do not match

254 Views Asked by At

I am using BizTalk Server 2013. I have a custom receive pipeline component in the disassemble stage. This component breaks the input xml message into separate messages based on "locations" node. For example, if the input message has 3 locations, then it will be broken into 3 messages, one for each location. The input message can also have an attachment as binary array. The custom pipeline component implements IDisassemblerComponent. For each location, a new message is created like this - outMsg = pContext.GetMessageFactory().CreateMessage(); In orchestration, the message Id is retrieved like this - messageId = myMsg(BTS.MessageID);

The business logic is dependent on the messageId to mark the request as processed.

Problem - When the input request does not have any attachment, the outMsg.MessageID and myMsg(BTS.MessageID) match and hence, business logic works and request is marked as complete. However, if the input request has an attachment then outMsg.MessageID and myMsg(BTS.MessageID) are different and business logic suspends the request. I used an attachment of 1 MB to reproduce this issue.

I tried to resolve this issue by promoting outMsg.MessageID in pipeline component and used it in orchestration instead of myMsg(BTS.MessageID). However, I am not sure if this is the right approach and want to find out and fix the root cause.

Why do outMsg.MessageID and myMsg(BTS.MessageID) match with no attachment and differ when request has attachment?

1

There are 1 best solutions below

1
On

If you create a new message, it will get a new MessageID. If you want an ID that is the same across all the messages that originated from the one message, you want the BTS.InterchangeID.

Also see Promoting the InterchangeID using a correlation set doesn't work - why not?