This question and response came up on a forum. I've never seen this referenced before so I thought it was worth blogging.

 

Problem:

BizTalk is receiving a flat file (can contain up to a million records) and doing a disassemble in a pipeline using a flat file schema. The individual messages are processed by  a sequential convoy (Singleton) based on a correlation. The orchestration receives the message in a loop that follows the correlation set from the receive port where receive location split the flat file into smaller messages.

To specify a proper exit criteria to exit the loop and stop the convoy I need to know the number of messages in the flat file. But since I am using the default flat file disassembler, I have no clue how many messages are in the  file.

 

Solution:

There’s a property promoted in the last of the disassembled messages in an interchange: BTS.LastInterchangeMessage = true.  This tells you the last message in the interchange and in conjunction with BTS.InterchangeSequenceNumber you can tell the total number of messages in the interchange (in case you get them out of order).

posted on Friday, June 13, 2008 5:27 PM | Print

Comments

Gravatar
# re: How to: After disassembling a message, how to know when to exit a processing loop when all messages have been received
Posted by Fernando on 8/23/2013 7:33 PM
You must check if the property exists before retrieving it like
if(BTS.LastInterchangeMessage exists MsgTransaction)
{
interChangeSequenceNumber = MsgTransaction(BTS.InterchangeSequenceNumber);

}
Post Comment
Title *  
Name *  
Email
Url
Comment *  
Please add 7 and 3 and type the answer here: