BAM Continuations

been asked about this a bit lately.  Posting here for future reference, extract from Keith Lims blog,   http://blogs.msdn.com/b/keithlim/archive/2006/02/08/527227.aspx
keithlim
8 Nov 2007 5:14 PM

#

Good questions Nick,

Let’s say that I’m using the BAM API only in custom pipeline components to create tracking for a pure messaging solution, and the string I’m using as an ActivityID is available everywhere I’m doing BAM writes. I’m not using the TPE anywhere, so I have full control over the tracking behavior. What’s the point of using continuations when I could just leave the activity active and continue writing to it using the ActivityID?

[KeithLim]:  If you use DirectEventStream, and write the events in correct sequence, no continuation is needed; i.e. BeginActivity,UpdateActivity and EndActivity, in that order.  And no UpdateActivity calls for that instance after that.

For all the other asynchronous EventStreams( BufferedEventStream, MessagingEventStream and OrchestrationEventStream or TPE enable segments)  continuation is needed when there is more than one EventStream instance is used. Long answer: Reason being that these events are actually persisted in intermediate MessageBox and are sorted according to their eventstreams instance ID. Since TDDS has multiple thread dequeing and processing these events to BAMPrimaryImport database, all the events with the same instance ID are guaranteed to be process in sequence. If there is no continuation in these cases, there is possiblily of dangling event occuring.  (instances having the same activity ID but one in completed and another in active.)

This also brings up another question: When I’m using continuation between segments of a solution, do I call EndActivity() at the end of every segment?

[KeithLim] Yes.

If continuation is enabled, is the activity actually moved into the Completed table or is it left in the Active table?

[KeithLim] By enabling continuation, the system actually insert a record in the continuation table. This ensure that for the instance, eventthough it has been issued BeginActivity and EndActivity, it will not be moved to completed table.

The full criteria for a activity to be completed:

IsActive = 1  (synonymous to BeginActivity call)

IsCompleted = 1 (synonymous to EndActivity call)

And there is no correspondent entry in Continuation table.

Hope these clarify any issues ambiguities you have.  Very good questions. 🙂

 

 

Advertisements
This entry was posted in BizTalk Server. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s