BAM is a very good way to monitor a process in BizTalk but often there is not enough time in a BizTalk project to implement BAM because it can take some time to implement it. The advantage of the ESB Toolkit is that you get (some) BAM out of the Box.
Normally you first have to create a BAM definition in Excel and after that deploy it with the command line tool BM. Also, you have to use the Tracking Profile Editor tool to map the activity definition to a process in BizTalk. With the installation of the
ESB Toolkit, there are already some activity definitions created. The logic behind the mapping is also done so you don’t have to use the Tracking Profile Editor anymore. You only have to deploy the BAM definitions so now you can enable BAM tracking very easily.
The following activity definitions are available in the ESB Toolkit:
The tracked BAM data give you answers on common questions such as:
Tracking Itineraries in BAM can be enabled in the Itinerary Designer Surface in Visual Studio. The Itinerary Designer Surface is a visual designer that is used to create Microsoft BizTalk ESB Toolkit itineraries and to export these itineraries into run-time
Runtime are the following fields as an activity record added in the the BAM Primary Import database:
You have to do this for all the Itinerary Services in your Itinerary. Every Itinerary Service that is tracked will result in a row in the bam_ItineraryServiceActivity_Completed table in the BAM database.
The ESB Exception Management Framework takes advantage of Business Activity Monitoring (BAM). This means that the ESB Exception Management Framework can track the exception data points with BAM, and then publish them to the BizTalk BAM Portal for monitoring.
When an error occurs, the following fields are as an activity record added in the the BAM Primary Import database:
The Microsoft BizTalk ESB Toolkit installs a Send Port named ALL.Exceptions that subscribes to all ESB fault messages and to all messages generated by the BizTalk Failed Message Routing mechanism.
ALL.Exceptions uses the ESBFaultProcessor Send Pipeline. The Fault Processor Pipeline BAM Tracker Component in the ESBFaultProcessor send pipeline adds the exception data to the BAM Primary Import database. Use the Enabled property to determine whether the
component will process the message and write it to the BAM database. When set to False, the component just sends the message to the next component in the pipeline.
To use BAM in the ESB Toolkit solutions, you must install the following prerequisite applications and services. Follow this sequence to install the prerequisites and to configure your system.
BAM itinerary tracking can be used to track the progress and eventual completion of itineraries as they advance through various steps. The BAM definition file (Microsoft.BizTalk.ESB.BAM.Itinerary.xml) is located in the BAM folder in the installation directory
and can be installed using the Bm.exe tool. Use the following command as an example.
Bm.exe deploy-all -DefinitionFile:" C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\Bam\Microsoft.BizTalk.ESB.BAM.Itinerary.xml"
The BAM definition file (Microsoft.BizTalk.ESB.BAM.Exceptions.xml) is located in the BAM folder in the installation directory and can be installed using the Bm.exe tool. Use the following command as an example.
Bm.exe deploy-all -DefinitionFile:" C:\Program Files (x86)\Microsoft BizTalk ESB Toolkit\Bam\Microsoft.BizTalk.ESB.BAM.Exceptions.xml"
You can verify the BAM results using a SQL query or the BAM Portal.
Start SQL Server Management Studio and create a query on one of the ESB Toolkit views in the BAMPrimaryImport database.
Start the BAM Portal from the Windows Start Menu and create a query on the BAM views.
With pure ESB runtime you don't have reports on the BAM data. You can edit the BAM definition files to create views on the BAM activities but another possibility is to create the charts yourself.
I've created a custom BAM Dashboard in ASP.NET for the ESB Toolkit that shows information about:
In the following example is the bam_ItineraryServiceActivity_CompletedInstances view used to determine the execution times of the itineraries.
List<ItineraryData> list =
// Get ConnectionString & SQL Query from web.config
connectionString = ConfigurationManager.ConnectionStrings[
sqlQuery = ConfigurationManager.AppSettings[
(SqlConnection connection =
(SqlCommand command =
(SqlDataReader reader = command.ExecuteReader())
ItineraryData iData =
iData.Name = reader[
iData.Date = DateTime.Parse(reader[
Figure 13. Visual Studio Toolbox
- Add a Legend to the Chart.
- Add a Title to the Chart.
// Get data from BAM database
BamManager manager =
List<ItineraryData> executionTimes = manager.GetExecutionTimes();
// Get distinct Itinerary names
= executionTimes.Select(x => x.Name).Distinct();
// Create Series
Series s = ExecutionTimesChart.Series.Add(value);
s.ChartType = SeriesChartType.Line;
s.BorderWidth = 2;
s.MarkerStyle = MarkerStyle.Square;
s.YValueType = ChartValueType.Int64;
// Add Points to the Chart
Series s = ExecutionTimesChart.Series.FindByName(iData.Name);
index = s.Points.AddY(iData.ExecutionTime);
s.Points[index].LegendText = iData.Name;
s.Points[index].ToolTip = iData.Date.ToString();
BAM is a very good way to monitor a process in BizTalk and with the ESB Toolkit you can implement BAM without having to do a lot of effort. Out of the box you can monitor itineraries that are processed in BizTalk and monitor Exceptions that have occurred
in BizTalk. With pure ESB runtime you only don't have reports on the BAM data. To solve this you can edit the BAM definition files to create views on the BAM activities but another possibility is to create the charts yourself.
You can download the sample tool with the source code here:
Read suggested related topics:
Another important place to find an extensive amount of BizTalk related articles is the TechNet Wiki itself. The best entry point is BizTalk
Server Resources on the TechNet Wiki.