共用方式為


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.

Comments

  • Anonymous
    February 23, 2006
    The comment has been removed

  • Anonymous
    February 24, 2006
    solved already, it was a different problem, had to do with whe activity used in the relation folder of the looping structere, I filled it with the activityID from the main activity, whereas I should have filled it with an equal valued activityID from within the loop. MS documentation might be a bit clearer on this one.

  • Anonymous
    February 24, 2006
    Was in class the last two days.  Great that you found the solution to the problem :)

  • Anonymous
    June 05, 2006
    The comment has been removed

  • Anonymous
    June 05, 2006
    Hi Jason,

    Without seeing your solution, I can only guess what went wrong.   Is the continuation segment in the Orchestration or pipeline or both?

    If the activity continues from an application to the biztalk pipeline and then to orchestration, then you would need:

    1) One ContinuationID folder for the pipeline to pair up with the continuation (EnableContinuation call) from the application.

    2) A pair of Continuation and ContinuationID folder for the pipeline and orchestration respectively.

    Could you send me an email with the artifacts via my blog page left pane email option.

    Thanks,
    Keith






  • Anonymous
    June 14, 2006
    Thanks,,

    I understand your points as i have observed the same explanations across the web.  I think the issue is coming from Tracking Profile Editor.  

    Everytime i track a message through an orchestration, it generates a new random guid for the activityid.  However, I set the activityid to a unique value within the message schema (in the TPE), but for some reason it still generats a new value.  This causes a series of row entries to be displayed in the portal for a single message.  

    Are you famaliar with some kind of configuration issue?  Does this make sense to you?

  • Anonymous
    June 15, 2006
    I think the confussion is in the TPE Select Event Source button.  When you click on this button, there are 4 options.  If you want to track anything from BizTalk orchestration, you must click on “Select Orchestration Schedule” option.  The other 3 options are applicable to Biztalk messaging (i.e. pipeline and port).

    Mapping from orchestration: once you have selected the appropriate orchestration (orchestration displayed on the right pane), to map a milestone, just drag the milestone to the appropriate activity milestone item. To map a dataitem, you would right button click on a particular shape and pick the Message Payload Schema (to map to message payload) and drag the appropriate schema item to the activity item.

    In other words, anything you want to track from the Orchestration, has to come from the Orchestration schedule, whether by dragging the shape (for milestone mapping) or dragging a schema item (for non-milestone item mapping).

    Let me know if this solves you issue.

  • Anonymous
    June 15, 2006
    This was definately the problem! I was messing with the TPE and realized that you cannot use the "select event source" to select the messaging payload, then drag.  You have to right click on the orchestration, then select messaging payload, then drag.  

    Guess its another one of BizTalk's goofy glitches.

    On another Note
    Do you happen to know if its possible to send message data within an alert.

    For instance: create an alert with a flat file transport, which includes the message "id or some unique identifier."  Also, have you heard any possibility to create custom transports?

    thanks

  • Anonymous
    June 20, 2006
    The comment has been removed

  • Anonymous
    June 28, 2007
    Many of you guys are eagerly anticipating the release of the Microsoft BizTalk Server 2006 R2… and the

  • Anonymous
    November 08, 2007
    The comment has been removed

  • Anonymous
    November 08, 2007
    The comment has been removed

  • Anonymous
    November 08, 2007
    Thanks so much for your quick reply. Continuations (and the way the engine handles BAM in general) now makes a lot more sense to me. There's one bit of your reply that has me a bit confused though - the part where you say you can get a "dangling event" (two instances of the same ActivityID, one in Completed and one in Active) if BAM calls are resolved by TDDS in the wrong order. As I was looking around for information about continuations, I found that the .NET class documentation for EnableContinuation (http://msdn2.microsoft.com/en-us/library/microsoft.biztalk.bam.eventobservation.eventstream.enablecontinuation.aspx) has a pretty good example of why you'd want to prevent calls on different instances of BufferedEventStreams from occurring out of order. That particular example, where some statistics are goofed up because certain bits of data weren't updated in order/on time, makes sense to me. However, I don't understand how you can get a "dangling event" - it seems like you'd just get an exception thrown instead. Let's say that updates to an activity are made across multiple instances of BufferedEventStreams. They all use the ActivityID so no continuations are needed on account of that, and the activity is simply left active in each segment except for the last one, where it is ended. All these calls go to the buffer, where they unfortunately occur out of order and the buffer that ends the activity occurs before a buffer that has an update. After the buffer that ends the activity resolves, the engine then attempts to resolve the buffer that updates an activity that is not in the Active table. If an update is attempted on an ActivityID that isn't in the Active table (even if it is in the Completed table), doesn't BAM throw an exception? For a dangling event to occur, the resolution of that buffer would have to create the activity before updating it, which it wasn't explicitly told to do. Thanks for your help!

  • Anonymous
    November 08, 2007
    I will attempt to answer the second part first since I think it will self clarify the first part. Answer to 2nd part. [keithlim] For performance reason, BAM does check the completed table for duplicate when inserting to active table.  It will however, throw an exception when it attempts to move the record to the completed and there is a duplicate id.   As I mentioned in my previous post, the BeginActivity is synonymous to IsVisible.  Once this is called the record becomes visible in the BAM Portal.  So if you really only want user to see the record after certain info is available, you can always call BeginActivity after you have update those column.  And calling BeginActivity several time does not hurt as long as the corresponding EndActivity has not been called.  You probably notice, only the main segment of the continuation has BeginActivity, the secondary segments do not and that why you don't see them in the Portal under their tokenized IDs.   Asnwer to 1st part: Since TDDS uses multipe threads in parallel to dequeue raw bam events off the messagebox,  it is possible for them to be processed in different order than they are inserted.  The continuation event ensures that the activity instance stays around even though the segment is completed.

  • Anonymous
    November 08, 2007
    Thanks! I didn't know that you could do an UpdateActivity without doing a BeginActivity first. Makes perfect sense now.

  • Anonymous
    January 21, 2009
    PingBack from http://www.keyongtech.com/327486-bam-activity

  • Anonymous
    February 24, 2009
    great article! I intend to modify the Bam alert's mail message. The scenario is that my alert condition can be a combination of many conditions and is time dependent as well (uses in the last operator), so if we simply provide the recepient with the link, it might return too much info in some scenarios, while in some cases the info might be "expired" (because of in the last operator). so I would like to add something like an interchangeId in my mail message. its part of my tracking profiles as well. i read ur reply- "BAM Alert and customizing message and provider." My question is where can i locate 'BAM help doc' and 'SQL NS doc' for writing custom transport. I need to know the input to the xslt, before i can change it! Will be great to know the resources that document the internals of BAM alerts for poosible extensions thanks in advance Ali

  • Anonymous
    April 07, 2010
    How can we use continuation in purely messaging only scenario. i.e only maps on ports are used and no custom pipelines or orchestration to call BAM API. I managed to do that somehow but end of actvity it remains in active table and doesn't get moved to completed table.