The simplest way to use BAM is to send explicit milestones or data, using the BAM API. You can think of the BAM Activity as a record in a SQL table that you are keeping in synchronization with the actual unit of work:
- Call BeginActivity for each new unit of work.
- Call UpdateActivity in critical places of the implementation, to send data and milestones that will be useful to the Information Worker.
- Call EndActivity when the work is complete and you expect no more events in the context of this unit of work.
The following code shows how to do use BeginActivity, UpdateActivity, and EndActivity when the unit of work is a Purchase Order. In the example, we assume that the string variable poid identifies the current Purchase Order in process:
using Microsoft.BizTalk.BAM.EventObservation;
...
EventStream es=new DirectEventStream(connectionString,1);
...
// At the beginning of the processing of a new work:
// Here poid is a string variable that has the current
// Purchase Order identifier (e.g. PO number)
es.BeginActivity("PurchaseOrder",poid);
es.UpdateActivity("PurchaseOrder",poid,
"POReceived",DateTime.UtcNow,
"POAmount",100,
"CustomerName",""Joe",
"CustomerCity","Seattle");
...
// few days later
es.UpdateActivity("PurchaseOrder",poid,
"POApproved",DateTime.UtcNow,
"ProductName","Widget");
...
// and another few days later
es. UpdateActivity("PurchaseOrder",poid,
"POShipped",DateTime.UtcNow);
...
// and finally
es. UpdateActivity("PurchaseOrder",poid,
"Delivered",DateTime.UtcNow);
es.EndActivity("PurchaseOrder",poid);
See Also
Microsoft.BizTalk.Bam.EventObservation Namespace
About BAM Activities
Activity Continuation
About BAM Dynamic Infrastructure
BAM API (BizTalk Server Sample)
To download updated BizTalk Server 2004 Help from www.microsoft.com, go to
http://go.microsoft.com/fwlink/?linkid=20616.
Copyright © 2004 Microsoft Corporation.
All rights reserved.