Enable routing for failed messages in BizTalk 2006
Enable routing for failed messages in BizTalk 2006
BizTalk Server 2006 introduces new functionality called “Enable routing for failed messages”, which enables simplified handling of pipeline errors. Enable routing for failed messages is specified on receive and send ports within the BizTalk Administration Console, as shown in the following figure.
BizTalk Server 2006 中新增了失败消息路由功能。发送/接收端口启用该功能后,会将失败消息重新发布到 MessageBox,消息上下文将额外带有错误报告属性(位于 ErrorReport 命名空间)。
By enabling this feature on a port, a clone of the error message is created, with all the original promoted properties demoted. However, the message has the appropriate error reporting properties promoted, such as the FailureCode, FailureCategory, Description, MessageType, ReceivePortName, InboundTransportLocation, and so on. You can get more information from the Reference 1. Then his message is delivered to the MessageBox, and can be subscribed to by using the filter (ErrorReport.Failurecode exists or ErrorReport.ErrorType=”FailedMessage”). The receive shape of the orchestration is of the System.Xml.XmlDocument type.
You can define a independent BizTalk project and add an orchestration as follows to subscribe that kind of failed message by using the filter. In the meanwhile, you can define a new FaultMessage schema to contain the Error Message from the ErrorReport context properties. The new context properties are as follows:
• Description
• ErrorType
• FailureCategory
• FailureCode
• InboundTransportLocation
• MessageType
• OutboundTransportLocation
• ReceivePortName
• RoutingFailureReportID
• SendPortName
For example, you can use the following code snippet to get the ErrorReport.Description information and write it into the event log.
System.Diagnostics.EventLog.WriteEntry("Test -- Failed Message",
msgIn(ErrorReport.Description));
References:
1. Using Failed Message Routing, MSDN
http://msdn2.microsoft.com/en-US/library/aa578516.aspx