Neil Thompson

BizTalk | .NET | SQL |

  Home  |   Contact  |   Syndication    |   Login
  15 Posts | 20 Stories | 45 Comments | 55 Trackbacks

News

Article Categories

Archives

Post Categories

Fav BizTalk Blogs

There is no sample for this, but if I get enough requests (say five or so) I'll create one and post it.

I decided to whip up a quick prototype of FailedMessage subscription in BizTalk 2006 and I ended up hitting a couple of bumps in the road on my first shot.  I'm the kind that does not stop and ask for directions, nor do I take the time to look at samples.   I try to do it on my own, and failing that, I'll hit the blogs.  All of that with a couple of trial and error sessions produced the following notes that I will use when trying this again:

Generating a FailedMessage

  1. Generating a failed message is easy.  Just submit a schema type that you are not looking for in any of your artifacts, or just unenlist the subscribers.
  2. Be sure to enable FailedMessageRouting on the port that is Receiving/Sending the erroreous message

When Using A SendPort subscriber to the FailedMessage

  1. Just create a send port and Set the filter criteria to ErrorReport.ErrorType == FailedMessage (do NOT put quotes around the failedmessage string)

When Using an Orchestration subscriber to the FailedMessage

  1. Create a receive port that is Direct Binding (the “will be defined by filter expressions“ one)
  2. Have your activating receive shape with the ErrorReport.ErrorType == “FailedMessage” (put quotes around the failedmessage string)
  3. Your receive message type should just be Xmldocument

Some Insights

  1. There are a handful of other ErrorReport fields that will help you narrow your subscription criteria if you wish I like the MessageType and ReceivePortName
  2. If your subscription to the FailedMessages is messed up, you will see TWO reports of failed message routing per message that you submit. I can only assume that this is because the attempt to route the failedMessage also fails.  If you want to explore this Disable/Enable FailedMessage routing on the port in question and see if it affects the number of reports you see.
  3. This is all about error handling so you have to assume that some pretty significant things are allready wrong. Depending on the stage at which you get the exception that causes the failedMessage, not all of the ErrorReport feilds will be helpful.  For instance, if the failure occurrs during the Xml[Dis]Assembly you can expect that the ErrorReport.MessageType will not be available.

Corollaries

  1. This errorRouting mechanism also has the usefull behaviour of suppressing suspended messaging instances. I had a Solicit-Response call to an unreliable webservice [aren't they all], that would fail periodically.  When it did fail it would suspend the orch and the message instance.  When I resumed them, it would send a dup message (on from orch and one from message instance).  I'm sure there's a better way to solve this one (but I don't stop for directions remember) so we enabled ErrorRouting on the send port.  The consequence of this was that, on failures, only the orchestration was suspended. Now when I resume, I do not get duplicate messages and I do not have to remember to terminate the message instances.

    By the way, I fiddled with the SuspendAsNonResumable on this and it never seemd to work the way that the help file described.  There was a lot of sketchy behavior surrounding the resuming of a failed web call... but that can be another post.
posted on Wednesday, October 11, 2006 6:12 AM

Feedback

# re: BizTalk 2006 FailedMessage Routing 4/30/2007 2:31 PM anonymous
thanks. I'm having trouble getting some of the ErrorReport properties, which you touched on. For instance, trying to use this (errorMsg is the inbound msg representing the failed msg):

errorMsg(ErrorReport.MessageType)

throws an exception. "There is no value associated with the property 'ErrorReport.MessageType' in the message." Even if I check it for null value first. Do you know how I can get these values when they are available, and if they are not, just continue and don't throw an exception? I need a way to know that the property is there and I can use it, or it is not and I should skip it. Same goes for InboundTransportLocation/OutboundTransportLocation and ReceivePortName/SendPortName. Since the failure happens on one or the other, but not both, one of the properties in each of those 2 pairs will have to be empty, but how to know which one? thanks again

# re: BizTalk 2006 FailedMessage Routing 5/9/2007 9:43 AM Sam Gordon
I have 2 applications, app1 and app2, and only app1 is subscribed to failed messages. When a message fails in app2, app1 picks up that failed message too. How can I restrict app1 to pickup only its failed messages?

# re: BizTalk 2006 FailedMessage Routing 1/9/2008 9:16 AM satya
Hi could u please post a sample for Enable routing for Error messages.

I need this for my project and it is urgent

thank u in advance

# re: BizTalk 2006 FailedMessage Routing 7/1/2008 10:55 AM daula
Post some sample please

# re: BizTalk 2006 FailedMessage Routing 7/1/2008 12:22 PM moyen
I have been trying to accomplish the same as you explained only that I have a decide shape whereby, if there's failure send an email otherwise send file to designated folder.

I have the following:
ErrorReport.ErrorType == "FailedMessage"

as the decide expression but is indicated to be a wrong construct

# re: BizTalk 2006 FailedMessage Routing 12/22/2008 11:17 AM Jacques
Try this for a decide expression:

ErrorReport.ErrorType exists msgIn


# Custom file addapter for ordered delivery 5/26/2009 4:12 AM Kavita
Hi,
I am working with biztalk 2006. I need help in implementing suspendAsNonResumable for suspending failed messages in my custom file adapter.

Thanks

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: