6.4. BAM API
As discussed earlier, there are four different types of event streams: DirectEventStream, BufferedEventStream, OrchestrationEventStream, and MessagingEventStream.
In many scenarios, the TPE will not be used. In such scenarios, you must program against the BAM API directly to provide monitoring data to the runtime; the API is very straightforward.
6.4.1. Creating Activities
To create a new instance of an activity, you need to call the BeginActivity method present on all the event streams. In this method, you provide the name of the activity you want to create as a string literal and an ActivityID as a string literal unique within the activity.
string ActivityID = System.Guid.NewGuid().ToString(); string FlightActivityName = "Flight"; bes.BeginActivity(FlightActivityName, ActivityID);
The BeginActivity method creates a new row in the bam_<ActivityName>_Active table, and all data items within the activity are defaulted to NULL.
The ActivityID uniquely identifies this activity and is used in subsequent calls to the BAM API to update data items in this activity.
GUIDs are typically used as ActivityIDs in most scenarios via the System.Guid.NewGuid().ToString() approach. If you're using BAM from BizTalk, however, you can make use of the BTS.InterchangeID context property, which is held on all BizTalk messages and is guaranteed to be unique for an interchange. The interchange relates to the transfer of the message between the adapter and MessageBox; although if you are splitting ...
Get Professional BizTalk® Server 2006 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.