Capturing BizTalk 2004 SQLAdapter failures

Posted by DanBedassa on Geeks with Blogs See other posts from Geeks with Blogs or by DanBedassa
Published on Thu, 17 Jun 2010 19:45:19 GMT Indexed on 2010/06/17 20:54 UTC
Read the original article Hit count: 259

Filed under:
I was recently working on a BizTalk 2004 project where I encountered an issue with capturing exceptions (inside my orchestration) occurring from an external source. Like database server down, non-existing stored procedure, …
 
I thought I might write-up this in case it might help someone …
 
To reproduce an issue, I just rename the database to something different.
 
The orchestration was failing at the point where I make a SQL request via a Response-Request Port. The exception handlers were bypassed but I can see a warning in the event log saying:
"The adapter failed to transmit message going to send port "
 
After scratching my head for a while (as a newbie to BTS 2004) to find a way to catch the exceptions from the SQLAdapter in an orchestration, here is the solution I had.
 
·         Put the Send and Receive shapes inside a Scope shape
·         Set the Scope’s transaction type to “Long Running
·         Add a Catch block expecting type “System.Exception”
·         Set the “Delivery Notification” of the associated Port to “Transmitted
·         Change the “Retry Count” of the associated port to 0 (This will make sure BizTalk will raise the exception, instead of a warning, and you can capture that)
·         Now capture and do whatever with the exception inside the Catch block
 
 

© Geeks with Blogs or respective owner