When we develop BizTalk applications, then most of the time, we handle exceptions at orchestration level though the use of catch exception block. And most of the cases, we have seen that exception is not handle at port level e.g. Receive Port and Send Port.
What’s happen when message failed at Receive/Send Port:
Whenever message is failed, then message will automatically go in Suspended Instances in BizTalk Admin Console.
Whenever message failed in BizTalk, then an error message is generated with having original message. And all its prompted properties will be demoted. The error message is a clone of the original message with selected properties related to the specific messaging failure promoted to the message context. We can see this info in Suspended Instance of message.
When a failed message is generated, BizTalk Server promotes error-report-related message context properties and demotes regular message context properties before publishing the failed message.
Now a day Business Require that alert mail will be generated whenever message will be failed at Port level as well as pipeline and message will not go in suspended instances, in this case we need to check the checkbox of Enable routing for failed messages on Receive Port and send port.
Below are some Message context properties of Error Report are promoted when message failed. for more details, you can check at
Exception Handling at Port level through orchestration:
Exception Handling at Port level through ESB Management Portal:
Exception Handling at port level is also a very important. If ESB Management Portal is already available on the BizTalk , if not then you can download from Microsoft site (https://www.microsoft.com/en-in/download/details.aspx?id=38166). its free available along with BizTalk Licence.
We just need to check the check box of Enable routing for failed message.
On Receive Port below screen is available in General tab in Receive Port Properties. We need to check the check box as below
On Send Port below scree is available at Transport Advance Options at Send port properties
We need to check the check box of Enable routing for failed message
How ESB Management Portal work at Receive/Send Port-
When ESB tool kit install on BizTalk server, then a ESB applications Microsoft.Practices.ESB is added at BizTalk admin console as below:
This ESB application can handle all the Custom and System exception of BizTalk Applications. And stored the data and exception details in ESBExceptionDb and can be track on ESB Management Portal. ESB Management Portal is a website which is hosted on the BizTalk server when we install toolkit. Through this portal we can add support team and Business user mail id. When any exception occur then this portal automatically generated alert mail.
Below screen is show the Filter of ALL.Exception Send port of Microsoft.Practices.ESB BizTalk Application.
Here we can see that this send port set the filter for properties of ErrorReport.FailureCode and Microsoft.Practices.ESB.ExceptionHandling.Schemas.Property.FaultCode. So when ever message will failed in BizTalk then this send port pick the message and send the details in EsbExceptionDb database from where ESB Management Portal get info.
Some times we need to check the failure details from database. Below table have all the details of failure message
Database Name: EsbExceptionDb
Fault: This table has all the exception related details. Error details, stack trace, failure time etc.
Message: This table has the information of Message e.g. Messageid, Interchangeid
MessageData: This table has the original message with MessageID. So we can retieve message data from this table.
Exception Handling in Orchestration with ESB
Exception handling at Port without using ESB:
Some times BizTalk doesn’t have ESB. So in that case Exception handling at port level can be done by the flowing way.
- Send Port: We need to create a send port which have the ErrorReport properties as well as ReceivePort/Send port name in filter. So this send port receive the failed message and send to destination location as configured. But this is not share any error details just send original message.
- Orchestration: We need to create a BizTalk application which have a orchestration to handle exception. in orchestration receive shape filter properties we need to apply ErrorReport properties and port name. Port name at filter is require otherwise it receive all the Exception of BizTalk. This orchestration receive Original message as with error details.
In below blog, I have defined a sample how to exception handling of Port through orchestration: