BizTalk WCF Adapter: Require a "Disable Receive Location after failures" option
When using WCF-Custom Adapter one can check the box ‘Disable Location on Failure’ under the ‘Messages tab’. While this is a useful functionality there might be cases when we wouldn’t want the receive location to get disabled for particular known faults or at least retry some times before disabling it. Say for example, when using WCF-Custom adapter with SqlBinding, a common problem might arise if the SQL server, which we poll, goes down or if there is a network disconnect for some time (> polling interval). We wouldn’t want the receive location to get disabled in such cases as such faults might be benign. What leads service host to faulted state, in such cases, is an exception thrown by a channel in the channel stack. An exception in a channel lead the corresponding channel listener communication object, and ultimately the service host, into faulted state.
In order to allow retrying before the receive location gets disabled, we can use WCF’s extensibilty to create a solution which would do the following:
1. Create a custom binding element (which will be the upper most element in the binding stack) which catches exceptions, maintains an exception counter, retries and throws only after specified number of exceptions have been thrown.
2. Create a custom endpoint behavior which modifies the binding stack of the endpoint binding by adding our custom binding element mentioned in 1.
By implementing BehaviorExtensionElement with our custom endpoint behavior we should be able to plug it into Biztalk WCF-Custom receive location”
The ExceptionCatcherBehavior can be downloaded from : http://biztalkserverteam.codeplex.com/releases/view/53456