Derek Tan's Blog

Continuation vs Relationship - When to use?

If an orchestration calls another orchestration multiple times, use relationship to model the process. Examples where this apply may include
  • A purchase order processing with each line item processed by another orchestration.
  • An exception handling orchestration that is invoked anywhere in the project where an exception may occur
To illustrate, suppose orchestration (Orch1) calls orchestration (Orch2) n times, where n is determined at runtime. To model this, create two activities (Act1) and (Act2) in the same Bam definition file which have data items and business milestones corresponding to Orch1 and Orch2 respectively. Using the Tracking Profile Editor (TPE), map the data items and milestones as usual. In addition, follow the steps at http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_prog_tracking_hgdm.asp to map the relationship. At runtime, the bam_Act1_AllRelationships view contains the mapping between instances of Act1 and Act2. Using this view and the bam_<ViewName>_<ActivityName>_View views for both Act1 and Act2, you can create queries to give information that you need for the entire process.
 
Another situation where modelling relationship may be more natural is when there are two different activities, like purchase order processing and shipment processing, and a single view is not what the user is after. At the same time, the user wants to relate these two activities in a way so that one can go from a purchase order number to find the corresponding shipment record. 
 
If there are multiple orchestrations but each orchestration is called only once, use continuation to model. The view that comes with the deployment of Bam spans the entire project. Note that in this case only one activity is needed. Other situations where continuation may be used is when events are sent from different artifacts, like pipelines and customized code. The Bam End-To-End (BizTalk sample) in the SDK shows how continuation is used to monitor events from pipelines across to orchestrations: http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/sdk/htm/ebiz_sdk_samples_bam_vgrs.asp
 
Published Wednesday, March 02, 2005 4:17 PM by derektan

Comments

 

AlexS said:

Thank you for making very good points!
I'm wondering how would you suggest handling a common case when Orch2 can be interrupted (for example by a throwing an exception in a parallel action in Orch1). BAM will not mark as 'completed' the active instance of Orch2 after that interruption.
March 2, 2005 6:21 PM
 

Derek Tan said:

Call Orch2 in atomic transaction context (scope that is inside the branch and contains the Call)
March 3, 2005 11:59 AM
 

BAM question | keyongtech said:

January 21, 2009 9:03 PM
New Comments to this post are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker