Friday, July 6, 2007

Why doesn't my atomic transaction retry?

An atomic transaction will retry in either of the following circumstances:

· When a RetryTransactionException is deliberately thrown by user code.

· When a PersistenceException is raised when the atomic transaction attempts to commit.

Note

Any other exception raised in an atomic scope will not cause it to retry even if you have the Retry property set to True. If you are not sure why the atomic scope is not retrying, double-check both the exception type and any custom code to ensure a retry-friendly exception was thrown.

A PersistenceException could happen if, for example, your atomic transaction was part of a distributed DTC transaction and some other participant in that transaction aborted the transaction. Likewise if there were database connectivity problems at the time when the transaction was trying to commit, a PersistenceException would be raised.

There can be several root causes for PersistenceException, depending on the situation, but what you generally observe is that all the XLANGs actions in your atomic scope seem to go through correctly, but then instead of committing, the scope fails. If that happens for an atomic scope that has Retry=True, then the atomic scope will retry up to 21 times. The delay between each retry is two seconds by default (but you can modify that value). After 21 retries, if the transaction is still unable to commit, the whole orchestration instance gets suspended. Then you can manually resume it and it will start over, with a fresh counter, from the beginning of the offending atomic scope.

Note

The atomic scope will retry up to 21 times. You cannot override this value from your code. For example, you cannot configure the atomic scope to retry only three times.

If you are using RetryTransactionException you can override the two-second default delay between consecutive retries by setting a different value for the DelayFor property. For more information, see RetryTransactionException.DelayFor Property.

Note

All variables will be reset when RetryTransactionException is thrown in an atomic scope.

Source: Microsoft

No comments: