Monday, 23 February 2009

ParallelBranch- Scope Synchronized=True

ParallelBranch- Scope Synchronized=True – How to Skip execution of all branches ?
What is the purpose of using “Synchronized=Ture” at Scope Shape?
When ever you want to use a variable across the Parallel branches you need to set the property for each branch Scope Shape Synchronized=True. In other hand we can say , Sharing a variable across the branches.
Let say you declared a variable “vGlobalVariable” at Orchestration Level and you are trying to update/ Set the value in each/ one of the branch , then you may encounter the below error ( when Synchronized=False – its default property for Scope Shape)
Error :
'vGlobalVariable': if shared data is updated in a parallel then all references in every task must be in a synchronized or atomic scope.

To over come this error you need to set the Synchronized=True. Fine what is the next issue ?

When you set Synchronized=True then each branch will execute one after one, for example if you have 3 branches like Branch1, Branch2 and Branch3. Then BizTalk executes the each branch in same order 1 , 2 and 3.

Now I have error at Branch 2 and I am catching the Error at Branch 2 Exception Block. But I do not want to proceed for Branch 3. How do I control the execution of all branches?

“ I came up with simple logic, It could be a silly but it works well, The logic is Declare a Bool type variable at Orchestration (vFlag=Tue) level and set the value at Each Branch Exception Block.
Also Second Branch and 3rd Branch should have Decide Shape to Check the Condition. “

You can also check the below article from “Scott Colestock” – for more Experiments on Parallel Branch.,guid,e2e45c5b-e8f3-4c05-9c60-d6e5e1ec29b3.aspx

The Orchestration looks like below

If you have any issues , reach me @

No comments:

Post a Comment