Continuation scenarios with mixed of TPE-enabled and non-TPE-Enabled tracking:

It has been a while since I last blogged on this.  Let's continue from where I left off. 

 

Let's pick two continuation scenarios: the first, a TPE segment continues to a non-TPE segment, and the reverse being the second.

 

 

1. TPE-enabled segment continues to a non-TPE-enabled segment.

 

In this scenario, you would need only a Continuation folder. The naming of this folder is important since the concatenation of the folder name and its mapped value will form the continuation TokenID used in non-TPE-enabled segment.  For example, if the Continuation folder name is "TPE2OES" and the mapped value has "PO123" for instance, the continuation TokenID would be "TPE2OESPO123".  Once you have mapped other data items and milestones, you will deploy* this.

 

In the related orchestration, in the process somewhere downstream, you will need to insert the following:

 

// Continuation segment using OrchestrationEventstream**

// Where ContinuationTokenID based on this instance contains the value ""TPE2OESPO123".***

Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.UpdateActivity("PurchaseOrder",  ContinuationTokenID,

        "Column1", Value1,

        "Column2", Value2);

 

Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.EndActivity("PurchaseOrder",  ContinuationTokenID);

 

 

2. Non-TPE-enabled segment continues to a TPE-enabled segment.

 

In the reverse scenario where an activity begins from an non-TPE segment,  the following code would be required:

 

// Sample main segment of continuation using OrchestrationEventStream.***

// Activity in this instance contains: "PO124"

Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.BeginActivity("PurchaseOrder",  ActivityID);

 

Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.UpdateActivity("PurchaseOrder",  ActivityID,

        "Column1", Value1,

        "Column2", Value2);

 

// CONTINUATION LINE HERE:

Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.EnableContinuation("PurchaseOrder",  ActivityID, "OES2TPE" + ActivityID);

 

Microsoft.BizTalk.Bam.EventObservation.OrchestrationEventStream.EndActivity("PurchaseOrder",  ActivityID);

 

To create the continue-to segment, in your tracking profile, you would need to add a ContinuationID folder, name this folder as "OES2TPE" and map the relevant item (one that will give you the above "PO124" for this particular instance of message.  Deploy* this and drop a message and see the beauty flows :)

 

 

 

*   You will get a warning that the tracking profile is missing the ContinuationID or Continuation folder, but since we know what we are doing :), just ignore and proceed.

 

** Note: there is no BeginActivity call since this is a continued-to segment. 

 

***The above can easilly be changed to used DirectEventStream or BufferedEventStream. If you do so, make sure you call the Flush method explicity or set the flush threshold to 1 or greater in the constructor.