I found a good step-by-step demo on how to implement BAM using TPE (Tracking Profile Editor) at the following address:
In this blog I’ll use the same sample to implement BAM using BAM API.
Prerequisites:
1. Download GenerateTypedBamApi from CodePlex (http://www.codeplex.com/GenerateTypedBamApi)
2. Download BAMSolution.zip from the above link.
Steps to implement BAM using BAM API:
1. Open BAMSolution.sln and create a new C# Class Library Project
2. Run GenerateTypedBamApi.exe POActivityView.xls POActivityView.cs Orchestration BAMSolution.Example
a. POActivityView.xls is BAM Observation Model
b. POActivityView.cs is a C# representation of the Observation Model
c. Select Event Stream (Orchestration)
d. Select Namespace (BAMSolution.Example)
3. Add the following references in your C# project
a. C:\Program Files\Microsoft BizTalk Server 2006\Tracking\Microsoft.BizTalk.Bam.EventObservation.dll
b. C:\Program Files\Microsoft BizTalk Server 2006\Tracking\Microsoft.BizTalk.Bam.XLANGs.dll
4. Add reference of C# project to BizTalk project
6. In BizTalk Project, create an instance of POActivityView.cs class
a. Type: BAMSolution.Example.OrchestrationESApi.PurchaseOrderActivity
8. Snapshot of the orchestration
10. BAM – Begin Shape:
bamActivityId = System.Guid.NewGuid();
bamOrchESobj = new BAMSolution.Example.OrchestrationESApi.PurchaseOrderActivity(bamActivityId.ToString());
bamOrchESobj.BeginPurchaseOrderActivityActivity();
bamOrchESobj.PONumber = POIn(POProcessing.PropertySchema.PONum);
bamOrchESobj.POAmount = (System.Decimal)POIn(POProcessing.PropertySchema.POAmt);
poDate = POIn(POProcessing.PropertySchema.PODate);
bamOrchESobj.PODate = poDate.ToString();
bamOrchESobj.Initial=System.DateTime.UtcNow;
bamOrchESobj.CommitPurchaseOrderActivityActivity();
11. BAM – Approved Shape:
bamOrchESobj.Approved=System.DateTime.UtcNow;
bamOrchESobj.POStatus=POAckMsg(POProcessing.PropertySchema.POStatus);
bamOrchESobj.CommitPurchaseOrderActivityActivity();
12. BAM – Rejected Shape
bamOrchESobj.Rejected=System.DateTime.UtcNow;
bamOrchESobj.POStatus=POAckMsg(POProcessing.PropertySchema.POStatus);
bamOrchESobj.CommitPurchaseOrderActivityActivity();
13. BAM – Hold Shape
bamOrchESobj.OnHold=System.DateTime.UtcNow;
bamOrchESobj.POStatus=POAckMsg(POProcessing.PropertySchema.POStatus);
bamOrchESobj.CommitPurchaseOrderActivityActivity();
14. BAM – Closed Shape
bamOrchESobj.EndPurchaseOrderActivityActivity();
Build, deploy and start the application.
Enjoy!
Comments
Post a Comment