O'Reilly logo

Professional BizTalk® Server 2006 by Ewan Fairweather, Kevin B. Smith, Darren Jefford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required