Click here to Skip to main content
13,150,622 members (44,611 online)
Click here to Skip to main content
Add your own
alternative version


14 bookmarked
Posted 27 Jan 2009

HOW TO Retry Atomic Scopes using RetryTransactionException

, 27 Jan 2009
Rate this:
Please Sign up or sign in to vote.
This article describes how to retry a atomic scope execution using a RetryTransactionException


There are several occasions where we use Atomic scopes in BizTalk. For instance, invoking a web service proxy as a class library or invoking a custom .NET component. In this article, we shall learn a way to retry/re-execute the code within the Atomic shape several times using a RetryTransactionException.


If you are new to Atomic scopes and would like to learn more, have a look at my article Parallel Branching and Scoping in BizTalk Orchestrations - Advanced Concepts.

Retrying an Atomic Scope

An Atomic scope does NOT have an exception block, but BizTalk provides a compensation section. In order for an atomic scope to be retried, we shall need to do the following:

  1. Set the Retry property for the scope to True.
  2. The component invoked must throw an instance of Microsoft.XLANGs.BaseTypes.RetryTransactionException class.
  3. Create an sub-scope which shall catch the exception and throw an instance of Microsoft.XLANGs.BaseTypes.RetryTransactionException.

The example orchestration below uses the sub-scope approach to retry Atomic scopes.

Orchestration Sample

The above figure depicts the scopes used, to correctly use the RetryTransactionException exception functionality.

  • The orchestration must have the 'Transaction Type' property set to 'Long Running Transaction (LRT)'.
  • The Main scope uses a 'Transaction Type' set to 'Long Running Transaction (LRT)'.
  • The Main scope contains the Atomic scope.
  • The Atomic scope contains a scope (Transaction=NONE) which has an exception block.

The exception block contains the following code...

throw new Microsoft.XLANGs.BaseTypes.RetryTransactionException();

Orchestration Control Flow

The sub-scope contained within an Atomic scope throws an exception, this exception is caught by the exception block of the sub-scope. The expression shape in the exception section throws an instance of RetryTransactionException.


  • Use the RetryTransactionException to retry Atomic scopes without having to write an extra line of code.
  • Throwing the exception RetryTransactionException shall retry the Atomic scope atleast 21 times.
  • Use the property DelayFor of the RetryTransactionException to set the time interval for retry.


  • 27th January, 2009: Initial post 


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Naveen Karamchetti
Architect AT&T Wi-Fi Services
United States United States
Naveen has done his Masters (M.S.) in Computer science, has started his career programming the mainframes and now has more than a decade of programming, development and design experience. Naveen has a sharp eye and keen observation skills. Naveen has worked for several companies and strived hard to build large scale business applications and bringing better solutions to the table.
Quite recently Naveen has built a fairly complex integration platform for a large bank. His hobbies include training, mentoring and research. Naveen spends his free time visiting National Parks nationwide.

Naveen has developed the BizTalk Control Center (BCC)

You may also be interested in...


Comments and Discussions

Generalconfiguring the retry count for RetryTransactionException Pin
Member 453983710-Sep-09 20:00
memberMember 453983710-Sep-09 20:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170924.2 | Last Updated 27 Jan 2009
Article Copyright 2009 by Naveen Karamchetti
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid