BizTalk + ESB Toolkit–flat file debatching
Problem (identfied with: BizTalk 2010 / ESB Toolkit 2.1 )
The ESB Toolkit is a set of components and artefacts which provide Enterprise service bus functionality on top of BizTalk. One of the capabilities of BizTalk is debatching (Xml, Flat files).
During debatching a single message is debatched into several messages (e.g. an OrderBatch containing multiple orders). The default behavior is that each message will be placed onto the messagebox for additional processing. In a business context it is desired that the entire batch is processed before the flat file is removed, thus Recoverable Interchange Processing should be set to FALSE.
In an ESB Toolkit context it is possible to follow the same approach, but not only debatch the message, but also start of a new process using an itinerary. This means that each individual messages leads to a new process.
In this case, the disassembler and the ESB Dispatcher are required to interoperate with eachother. This behavior is however, not supported and will result in the following error:
Reason: Cannot access a disposed object”. Object name: ‘DataReader’. |
Solution
There are multiple approaches to circumvent this problem:
· Customize the default Flat file adapter / ESB Toolkit components
o This is an unsupported approach, complex and
· Use InterchangeProcessing = TRUE
o This would mean that messages are handled on an individual basis, which prevents that there is a dependency on the entire stream.
o The drawback of this is that messages that fail can not be traced back to the entire batch
· Use a 2 step appoach
o First the flat file is debatched
o In the second step the Itinerary is assigned
How-it-works.
· Use a 2 step appoach (instead of 1 step)
· In step 1a, the flat file is debatched in a pipeline that contains a flat file disassembler (default pipeline component)
· In step 1b, the debatched file files are send to an intermediate location, awaiting processing
· In step 2, the Itinerary is assigned using a pipeline with an ESB Itinerary selector and ESB Dispatcher pipeline component (default pipeline)
HTH,
Sander Nefs
Comments