This post discusses Failed Message Routing and Failed Orchestration Routing in BizTalk 2006


Failed Message Routing

Failed Message Routing is a new feature of BizTalk 2006.
You can read about it here: Using Failed Message Routing

Below is an excerpt from the above help topic:


What Does Failed Message Routing Consist Of?

When failed message routing is enabled, BizTalk Server does not suspend the message—it routes the message instead. Failed message routing can be enabled on both receive and send ports, with the following results:
If failed message routing is enabled on a receive port and a message fails in the receive pipeline or in routing, a failed message is generated. In the case where an error occurs in or before the disassembly phase, the error message is a clone of the original interchange. If failed message routing is enabled on a send port and the message fails in the send pipeline, a failed message is generated. 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. Compare this to the default behavior when failed message routing is not enabled: Messages that fail are suspended.


There is much more information in the above article. I would highly recommend reading it. One of the properties promoted on a failed message is:


ErrorReport.ErrorMessage = “FailedMessage”


You can then subscribe to a failed message using a Send Port or Orchestration by filtering on the above property.


Failed Orchestrations Routing


There is no such thing. If an orchestration suspends, the orchestration and its contained messages will become suspended. If you have an orchestration or send port with a filter such as:
ErrorReport.ErrorMessage = “FailedMessage”


It will not subscribe to the failed orchestration. No failed message is automatically generated that can be subscribed on orchestration failure. But, if you have set up a subscriber that is set up for Failed Message Routing and would like a message generated by the Failed Orchestration to be routed to the same subscriber, you can do the below:


1) As below, add a scope shape and exception block in the orchestration to catch exceptions in the orchestration:



2) In the exception block construct a new message in the orchestration. While constructing the new message, promote the following property:


msgError(ErrorReport.ErrorType) = “FailedMessage”;


See below for an example:



3) As below, use the orchestration view to create the following Correlation Type.



4) As below, use the orchestration view to create a Correlation Set that derives from the Correlation Type.



5) As below add a Send shape to send out the newly constructed message. For the properties of the Send Shape, initialize the correlation set from 4).



6) As below, link the send shape to a Logical Send port in the orchestration that will do a direct send into the messagebox.



7) The ErrorReport.ErrorType is now promoted on the error message and you can now subscribe to it, using a filter condition as:


ErrorReport.ErrorType = FailedMessage
(if using a send port)
Or:
ErrorReport.ErrorType = “FailedMessage”
(For a Receive Shape in an orchestration.)


Note: You can also promote your own custom context property as described Here
There is an example that you can download Here. Read the Readme before installing.