www.codeguru.com/cpp/data/mfc_database/sqlserver/article.php/c11493/

Back to Article

Home >> Visual C++ / C++ >> Data >> Database >> SQL Server


Put Some "BAM" in Your Next BizTalk 2004 Project
Rating: none

Jeffrey Juday (view profile)
February 24, 2006

Go to page: Prev  1  2  

BAM Databases and DTS Packages

Figure 10 displays the tables created in the BAMPrimaryImport database after the BM.EXE utility executes.


(continued)





(
Full Size Image)

Figure 10. Tables Created in the BAMPrimaryImport Database

BAM will copy the data to a particular table depending on whether an Activity is "Active" or "Completed." Tables are created with the appropriate keys and unique indexes depending on how you call the API or define the Tracking Profile (more on the BAM API and Tracking Profiles later). Figure 11 shows some data from one of the tables in the sample application.


(Full Size Image)

Figure 11. Data from One of the Tables

In addition to tables, BAM also creates a set of stored procedures for use by the BAM API (see Figure 12).


(Full Size Image)

Figure 12. BAM Stored Procedures

Figure 13 lists the DTS packages created when the BAM Definition is deployed.


(Full Size Image)

Figure 13. DTS Packages

The DTS Packages perform actions like archiving and populating Analysis Services Cubes. You can modify the packages to perform other operations.

Once you've created and deployed your BAM Definition, you have two implementation options:

  • Use the BAM API to collect your BAM Activity Items.
  • Collect your BAM Activity Items using a Tracking Profile.

Calling the BAM API

As stated earlier, the BAM API has a synchronous (DirectEventStream) and an asynchronous (BufferedEventStream) form. The following code from an Expression Icon in the Sample Orchestration illustrates how you invoke the BAM API:

bamDirectEvent =
   new Microsoft.BizTalk.Bam.EventObservation.
   DirectEventStream("Integrated Security=SSPI;Data Source=.;
                      Initial Catalog=BAMPrimaryImport",0);
bamDirectEvent.BeginActivity("IterationTrackingDirect",IDValue);
bamDirectEvent.UpdateActivity("IterationTrackingDirect",
   IDValue,"IDValue",IDValue,"IterationNumber",NumIterations,
   "Descrip",Descrip,"RecordDate",System.DateTime.Now);
bamDirectEvent.EndActivity("IterationTrackingDirect",IDValue);

The DirectEventStream and BufferedEventStream have the same set of functions. BeginActivity initiates the logging, UpdateActivity continues the logging, and EndActivity ends the logging.

The main differences between DirectEventStream and BufferedEventStream are:

  • The BufferedEventStream uses the BizTalk Messagebox and then writes the logging data to the SQL database.
  • DirectEventStream writes directly to the SQL database.

The BAM API classes are located in the "C:\Program Files\Microsoft BizTalk Server 2004\Tracking" folder, in an Assembly called Microsoft.BizTalk.BAM.EventObservation.

The BAM API also includes functionality for redirecting BAM Activity to other data sources in a set of BAM Interceptor functions and Interfaces.

As stated earlier, the BAM API was one option for implementing BAM. The easiest way to implement BAM in your orchestration is to create a Tracking Profile.

Setting Up a Tracking Profile

The Tracking Profile Editor is one of the BizTalk administration tools. Select File -> New, and then select your Orchestration to create a new Tracking Profile. A mock-up of your Orchestration will appear in the tool (see Figure 14).


(Full Size Image)

Figure 14. Tracking Profile Editor

To link your Orchestration to an Activity Definition, right-click on the Orchestration and select Import Activity Definition. When you import the Activity Definition, a screen like the one in Figure 15 will appear.


(Full Size Image)

Figure 15. Import the Activity Definition

Map the Activity Items to steps in your orchestration in the following manner:

  1. Milestone Items can be mapped by dragging and dropping the Orchestration Icon you want to relate to the milestone.
  2. To map other Items, you must connect the Item to data in a message. To do this, right-click on Icons (which create messages), select the appropriate schema, and drag the appropriate element in the message to the Activity Item.

To deploy the Profile, select the Deploy option on the File menu.

Tracking Profiles still utilize the BAM API. When you use a Tracking Profile, instead of writing code BizTalk performs the API calls for you.

Now that you have completed your BAM implementation, consider some final issues.

Using What You've Logged

You won't realize the true value of BAM until you use the BAM logging data with tools like Reporting Services and Notification Services.

If you've included things such as Purchase Orders and other keys in your BAM data, you can combine the BAM data with data in other databases. For example, you can modify the DTS packages to divert your BAM data to another database that includes more detailed information about your business process, and then generate reports using Reporting Services.

If you want to generate special notifications based on your data, you can build the Notification using Notification Services.

Any other tool capable of reading SQL Server data also can utilize the BAM logged data. If you want to experiment, start with the BAM Definition spreadsheet. The spreadsheet has built-in functionality for reading the Analysis Services Cube data. You can use the spreadsheet to prototype your ideas.

Record Your BizTalk Orchestrations' Progress

BAM allows a developer to record the progress of your BizTalk Orchestrations for consumption by tools such as Reporting Services. BAM is straightforward to set up, and it can execute in a synchronous and asynchronous fashion depending on your performance requirements. Finally, BAM can be customized to write data to other databases to satisfy any reporting requirements.

Sources

  • BizTalk 2004 Unleashed, Woodgate 2004
  • "BizTalk Server 2004: A Review of the Business Activity Monitoring (BAM) Features"

About the Author
Jeff is a software developer specializing in enterprise application integration solutions utilizing BizTalk, SharePoint, WCF, WF, and SQL Server. Jeff has been developing software with Microsoft tools for more than 15 years in a variety of industries including: military, manufacturing, financial services, management consulting, and computer security. Jeff is a Microsoft BizTalk MVP. Jeff spends his spare time with his wife Sherrill and daughter Alexandra.

Go to page: Prev  1  2  

Downloads

  • BAMSampleCode.zip - Download sample code - 861 Kb

    Tools:
    Add www.codeguru.com to your favorites
    Add www.codeguru.com to your browser search box
    IE 7 | Firefox 2.0 | Firefox 1.5.x
    Receive news via our XML/RSS feed






  • internet.commediabistro.comJusttechjobs.comGraphics.com

    Search:

    WebMediaBrands Corporate Info

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs