Note on BizTalk Compensation

I was goofing around with Compensation blocks, as I prepare for the BizTalk 2010 Certification exam. I expect to get one or two questions about Compensations, so I at least wanted to play around with them some. I use scopes for exception handling all the time. However, compensation isn’t something I have really implemented.

That being said, I was having a little bit of trouble actually getting a Compensation block to fire. Well, it was for one simple reason – like “smack your forehead simple.” Fortunately, the wonderful interwebs contained the answer.

  • The Compensation section for a scope gets activated only when the scope terminates normally or the scope completes its execution.

I was trying to stack a compensation block underneath an exception block. That use case violates this rule. In order to compensate, I had to create nested scopes, such that the inner scope transaction completed, and the exception occurs afterward (I purposely caused a div by zero error). Then the outer scope’s exception handler calls the compensation block of the inner transaction scope.

This article (from way back in 2006!) has great screen shots and useful information about compensation in BizTalk.

Happy Orchestrating!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s