Click here to Skip to main content
15,886,519 members
Articles / Productivity Apps and Services / Biztalk

BizTalk's Business Activity Monitoring(BAM)

Rate me:
Please Sign up or sign in to vote.
4.71/5 (6 votes)
23 Jan 2015CPOL18 min read 52.3K   362   4   16
Tutorial on Implementing BAM solution for a BizTalk Project

1.Introduction

BAM (Business Activity Monitoring), As Ecommerce industries are booming every day, Middle-ware systems plays a vital role in integrating with different vendors/Partners to complete the supply chain. Business world expects all the transactions to be monitored, irrespective of cost involved in each transaction. As Business Intelligence solutions are fully depending on the Scheduled data sources, real time monitoring can happen only through a real time data source. BAM acts as a miniature real-time Business Intelligence model to cater real time monitoring in BizTalk or any WCF based tracking. As BAM ships along with BizTalk Server package, it is widely implemented with BizTalk projects. As a BizTalk Developer, I just wanted to pen down my thoughts about BAM in this article to make this as a starter kit for BizTalk BAM professionals which will be helpful to break the ice to start off with BAM development

1.1.Prerequisites

This Article assumes that, you have basic knowledge on the BizTalk tool and configured BAM in BizTalk Configuration tool and MS Excel to proceed with the implementation

1.2.Business Intelligence

As we all know, Business Intelligence solutions are available in variety of technologies but the base of all Business Intelligence tools are three components

ETLà Extract, Transform and Load, Which constitutes of raw data and acts as a data source

Analysisà Data Analysis is the Process layer, in which the data is converted to Multidimensional views

Reporting à Reporting comprises of comprehensive Presentation layer with advanced data representation

 

1.3.MSBI and BAM

Let me start with a Microsoft way of thinking.

MSBI, Microsoft Business Intelligence uses SSIS, SSAS and SSRS as an ETL, Analyzer and reporting tool respectively to form the complete Business Solution.

SSIS --> SQL Server Integration Service àActs as an ETL tool

SSAS --> SQL Server Analysis Service à Acts as an Analysis Tool

SSRS --> SQL Server Reporting ServiceàActs as a Reporting Tool

BAM in-turn also uses all the three tools to form the comprehensive real-time tracking and reporting. You can see the BAM tracking in a very minute seconds. The BAM Infrastructure is designed for a low latency high performance which makes you to visualize the data in fraction of seconds in BAM portal.

 

 

1.4.Comparison Table

 

 

 

Data Source

Data Analyzer

Data Reporter

MSBI

SSIS

SSAS

SSRS

BAM

Movement of data from Message box to Tracking data

Analysis Service(Measures/ Dimensions)

BAM Portal(Grid/chart view)

 

 

Business Intelligence

 

 Business Activity Monitoring

 

 

1.5.SSIS and BAM Architecture

 BizTalk relies on the powerful Publish subscriber Architecture, in which Message box database acts as a Heart of BizTalk Engine. From the Perspective of BAM, consider the Message box a real time source of data. But as we need to have control over the data, we need to copy the data to BAM specific database called as BAM Primary Import.

The movement of data from BizTalk Message box to BAM Primary Import database is the responsibility of Tracking Data Decode Service, Which internally uses SSIS packages to perform this action step at run time.

Also movement of data between BAM specific databases/tables also carried out by SSIS packages

 

1.6.SSAS and BAM Architecture

We have the raw-data in BAM Primary Import Database, we need to make an analysis of available data and form the comprehensive data to users. Eg: Total number of transactions per day, Average of the transactions, etc. This analysis decisions are left to the business, in which way they want the report to be in.

This Analysis of data is done for the Measures and Dimensions in BAM

Measures are the numeric aggregation of data

Dimensions are the measures represented in terms of time

Measures and Dimensions forms the comprehensive Business Report,  for which BAM can provide the Grid or chart views

1.7.SSRS and BAM Architecture

BAM Portal acts a User-Friendly presentation layer in BAM Architecture. Representation of data can be done in Grid or chart view. BAM portal adds a query service for quick search of the Milestones or data that is being tracked. BAM portal represents the data in the form of Activities and Views. Activities

1.7.1.Activities

Activities represent atomic information units that need to be monitored. In General, Activities are the collection of fields that represents the Business milestones and Business data. Activities are represented in terms of Grid Views in the BAM portal

1.6.2. Business Milestones

Milestones are the time specific data which is used to represent the state of business process. EG: ReceivedTime and SendTime

1.7.2.Views

View is the collection of activities, which is used to represent data based on the expectation of Different business roles.

As all the data in BAM Primary Import can be utilized as Relational data, BAM  capability can be extended to make your own way of reporting through SSRS.

1.7.3.Real time Aggregation in Excel

BAM Data can also be viewed in Excel sheet through Real time Aggregation with the help of Pivot tables.

This Paper makes you to understand BizTalk Architecture at Run time by a practical examples

2.BizTalk Architecture

BizTalk works on the Principle of Publish-Subscribe Architecture, Where a message gets into BizTalk; it undergoes set of stages in different artifacts and published to message box with or without transformation (map). Then the Subscribers/Listeners will subscribe the messages, apply the transformation, passes through the pipeline and the message is sent out of BizTalk

Artifacts in BizTalk:

Adapter, Pipeline, Schemas, Maps etc

 

3.Ecommerce Scenario

Let’s take a simple E-Commerce solution; ABC Ecommerce Industry has a BizTalk as the Middleware and SAP as backend. The Customer order which passes through BizTalk to the Backend system for further supply chain processes.

3.1.Inbound Flow

 

 

 

The Backend system asynchronously sends three responses: Acknowledgement/ Processed / Failed based on the status of the order

3.2.Outbound Flow

 

 

As this transaction status of Order is very important, this has to visible to the Business users, we will design a BAM monitoring for this scenario. Create a BizTalk Application and design a BAM solution.

3.3.Create a Simple BizTalk Application

Follow the below steps to create a Message only BizTalk application (Without Orchestration)

  1. Create a new BizTalk Project in the Visual studio and name it as BAMTraining
  1. Create an Inbound schema as below and name it as InboundOrder.xsd(all elements are string datatype)

This will be the Request flow message for our scenario.

  1. Create another schema as below and name it as outboundOrder.xsd (all elements are string datatype)

  1. Deploy this project to BizTalk Administration Console
  1. Create the Receive ports Receive Ports and Receive Location

 

 

  1. Create the Send ports and subscribe to the corresponding Receive ports

 

 

  1. Now try with the sample Inbound file and outbound file after restarting the host instances

Now let’s design the tracking solution for this message only project, which is been deployed in your machine.

3.4.Tracking Scenario

Before designing we need to make sure two questions are being answered

  1. What to track àKey Decisive Elements/ Business Data / Business Milestones
  1. Where to track à Receive side or send side

Let’s consider the Receive port as the Tracepoint1 and send port as the Tracepoint2.

 

 

We will be tracking below elements on the send and receive side

Note: Send port time indicates that the message has been successfully delivered to the end system. If it is not getting populated, it indicates that there is a transmission failure or any internal BizTalk Failures.

3.BAM Architecture

As we all know Messagebox is the heart of BizTalk, but BAMPrimaryImport database is the heart of Tracking. Message box database will transport the data to BAMPrimary Import database, isolating the Tracking from BizTalk Engine.

When a Message been published to Messagebox, the messages will get sustained in the Messagebox till the Life cycle of the Message (Until the message gets subscribed by all the subscribers).

After the Message life cycle the messages gets deleted from Message box. Inbetween these two tasks, if the BAM is been implemented to the BizTalk solution, the heartbeat signals will initiate the movement of data from the Messagebox to the BAMPrimaryImport Database.

This movement is done by the TDDS service (Tracking Data Decode Service). TDDS is also responsible for moving the data to the DTATracking DB. The Published message and subscribed message along with the milestones can be tracked with the help of BAM.

BAM Event Processors help in triggering the Business Events and mapping them to Activity models in BAM Primary Import Databases. Once you deploy the BAM solution, at run time the messages move from messagebox to other databases. Keep in mind that tracking will not happen in the message box, to reduce the overhead on it.

Note: message payload will be in compressed/encoded format, TDDS service (Tracking Data Decode Service) is responsible for decoding and moving the data to BAM Primary Import DB and DTA DB.

 

DTA Tracking can be implemented by enabling tracking at the ports through BizTalk Administration Console, which will help in viewing the message by Tracked Message Events in the BizTalk Admin console.

Once the specified time of 1 month (Online window) is reached, the message gets partitioned in the BAM Primary Import database. The Partition of BAM tables is done by the help of SSIS packages, which gets created during the deployment of BAM Definition File. Also, more than one month data will be archived in the BAM Archive DB. SSIS Packages, which gets created during the deployments, are responsible for these movements.

3.1.BAM Databases

List of Databases which gets created when BAM is installed and configured. Below Databases helps tracking to achieve its various Functionalities as below

Databases

Purpose

BAM Primary Import

Data source/ Heart of BizTalk Tracking

BAM Archive

Archived data based on the Time window

BAM Star Schema

Data Analysis like Measures, Dimensions and Chart views are analyzed

BAM Analysis

BAM Alerts Application

BAM Alerts Management Database

BAM Alerts NS Main

Notification service for triggering mail through SMTP

Also BAM holds the concepts of Continuations and Relationships which used to enhance the relational activity model.

3.2.Continuations

Business world expects all possible relations in one single activity. The Split of details in different activities, will make it a cumbersome process to make a key Decisions. Hence BAM displays the continuity of operations with the help of Continuations. In General, Continuations are the unique concept in BAM which is desired to correlate the inbound and outbound messages.

3.3.Relationships

Activities are the atomic information unit of Monitoring. Different Activities are to be correlates to provide a comprehensive data. This Coalition between different activities is achieved through Relationships in BAM.

4.Implementing BAM Solution

Implementation of BAM tracking can be done by following steps

  1. Create a BAM Definition File using MS Excel (For creating relevant tables, Views, SP’s etc.)
  1. Create an TPP file using Tracking Profile Editor ( Responsible for binding the data to the ports)

4.1.     Create a BAM Definition File using MS Excel

4.1.2.   Create activities and Views in Excel sheet

In BAM everything is represented in the form of activities and view. The creation of activities and Views in Excel sheet is equivalent to designing the container that represents data to the end users. We need to know, what are the Key columns (KPI) that has to be tracked which will enhance the users understandability

Activities are the data tables which collect information from the source (Orchestration, Pipeline, WCF Interceptor)

View is a collection of activities, where in it can represents collective data information to the business

4.1.3.   Create Activities

Goto MSExcel>> Add-ins>>BAM>>BAM Activity

4.1.4.   Creating Milestones/Business Data for Inbound Activity

Name the activity as InboundOrder and click on new item to create columns. All the columns should be assigned to a datatype as shown below

 

Note: Business Milestone is the datetimestamp which will be used to display the message arrived in time and Message dispatch time. All the other column datatype is text

4.1.4.1   Creating Milestones/Business Data for Outbound Activity

Follow the same procedure for creating a Outbound Order Activity with the below details

After creating two activities, you will get a screen as shown bleow

 

4.1.4.2   Create Views

As the activities are created, Views will helps in representing multiple activities in the BAM portal

Click on Ok, you will be navigated to the initial View Page

Click on the Radio button Create New View and click next

select the View name and select the activities in the next window, as shown below.

We can create n number of views for a single activity, to cater different users. Now select all the data items whichever you have created in both the activities

 

and click couple of next, to get into the final page, as we are not covering measures and dimensions.

This Page will create the Excel sheet with full details.

The BAM defintion can be in Excel or in XML, as XML is cross server compatible, always prefer using the XML exported defintion file. Now export the BAM Definition file to the xml format and save it as BAMTraining.xml

 

4.1.5.   Deploy the BAM Definition file

The BAM Definition file (BAMTraining.xml) should be deployed using the BAM Command line utility.

Deploying of BAM definition file will create corresponding database tables, views, SSIS packages, etc which will organize the data in a relational view.

Follow the below steps for deploying BAM Definition file

  1. Open Command Prompt as administrator
  1. Navigate to the %BTSInstallPath%/Tracking folder
  1. Use the  Command

bm.exe deploy-all –DefinitionFile:”<<FileLocation>>\BAMTraining.xml”

BAM Definition deployed successfully :)

4.1.6.   At the Backend

When you deploy the BAM Definition file, details of your tracking solution will get into the BAM Metadata tables in BAM Primary Import and also following artifacts gets created in the BAM Databases

4.1.6.1. Activity related Tables

4.1.6.2. Views related the activities

4.1.6.3. SSIS Packages for Partitioning/ Archiving/ Data Movements

SSIS Packages will get created in the Integration services, which will help in Partitioning and Archiving the BAM data for better performance.

SSIS Package Name: BAM_DM_<Activity Name>

4.2.     Configure and deploy tracking profile editor file.

4.2.1.   Profile Editor

Tracking Profile editor defines the way in which the data should be tracked. Tracking Profile editor tool will be Responsible for binding the data to the ports.

4.2.3. Configuring Tracking Profile Editor for Inbound Order Request

As we had already deployed the BizTalk solution and BAM Definition file, Now its time to link the both using the Tracking Profile Editor

  1. Goto Start>> Tracking Profile Editor

Left Pane à Activity Definition file

Right PaneàBizTalk Deployed Message/Context properties

  1. Click on the Left pane “Click here to Import a BAM Activity Definition” and select the InboundOrder from the Popup

 

 

  1. Activity Columns has got populated now

  1. Select the Event Source:

Event Source is the place from which data is populated in the BAM

Event source

Description

Orchestration Schedule

Orchestration Properties

Messaging Payload

Deployed Schema Elements

Context Property

BizTalk Context Properties

Messaging Property

Message/Port Properties

 

  1. Follow the below table and drag and drop the properties from right pane(event source) to the Left Pane(Activity Columns)

Activity Column Name

Event Source

Property/element Name

Port Name

OrderID

MessagingPayloadàBAMTrainingà

InboundOrderàOrderID

OrderID

InboundReceivePort

ProductID

MessagingPayloadàBAMTrainingà

InboundOrderàProductID

ProductID

InboundReceivePort

XProductName

MessagingPayloadàBAMTrainingà

InboundOrderàProductName

ProductName

InboundReceivePort

ShipmentAddress

MessagingPayloadàBAMTrainingà

InboundOrderàShipmentAddress

ShipmentAddress

InboundReceivePort

RcvPortName

ContextProperty à BTS.ReceivePortName

BTS.ReceivePortName

InboundReceivePort

RcvdTime

Messaging PropertyàPortStartTime

PortStartTime

InboundReceivePort

SendPortName

ContextProperty àBTS.SPName

BTS.SPName

InboundSendPort

SendPortTime

Messaging PropertyàPortEndTime

PortEndTime

InboundSendPort

 

 

  1. To Insert Continuation>>Right click on Inbound Order>>New Continuation and Assign Interchange ID from Receive port
  1. Also >> Right Click on Inbound Order>>New Continuation ID
  1. Rename ContinuationID to Continuation (Both should be of same name)and assign Interchange ID from Send Port
  1. At last your Tracking Profile should resemble like the above image, save it as TestInboundTPE.tpp file
  1. Goto File>>click on Apply Tracking Profile

This makes you to successfully deploy the tracking profile file into the BAM solution

 

 

 

 

4.2.4. Configure Tacking Profile Editor file for Outbound Order Activity

Open a New Tracking Profile Editor and open the OutboundOrder Activity on Left Pane and assign the Values as shown below

Activity Column Name

Event Source

Property/element Name

Port Name

OrderID

MessagingPayloadàBAMTrainingà

InboundOrderàOrderID

OrderID

InboundReceivePort

RcvPortName

ContextProperty à BTS.ReceivePortName

BTS.ReceivePortName

InboundReceivePort

RcvdTime

Messaging PropertyàPortStartTime

PortStartTime

InboundReceivePort

SendPortName

ContextProperty àBTS.SPName

BTS.SPName

InboundSendPort

SendPortTime

Messaging PropertyàPortEndTime

PortEndTime

InboundSendPort

 

 

In the Above image, InboundOrder indicates the relationship to the OutboundOrder. There should be one commonid which is Order id in our case.

Goto>>File>>Apply the configuration

The Binding between ports and BAM is applied, which will help BAM events get triggered when the message arrives in the port and populate the data in BAM tables.

5.How Continuation Works

Consider the Inbound Activity

We have configured the Tracking profile editor to track both the tracepoints into a single activity.

Let’s take the above 1:1 scenario

Tracepoint1- Inbound message

Tracepoint2 – Outbound message

The Continuation between Tracepoint1 and Tracepoint2 is established out through one common id called InterchangeID (Which is same on the receive and send port).Whenever inbound message arrives, the Active table gets populated.

When outbound message delivered successfully, data will move from active table to completed table. All Instances (SQL view), which combines both Active and Completed table, will be responsible for the data to be displayed in BAM

5.1.Movement of data in the Activity Tables

 

5.2.Testing the Continuation scenario

As we have configured the BizTalk Application, Stop the InboundSendPort and post the below message to the Receive location

Message has been picked up and failed to send to send port location and suspended in BizTalk. Let’s see the Back end tables result

5.2.1.Active Table Values

The below snapshot shows the Business data and milestones tracked at receive port

5.2.2.BAM View

Representation in BAM view

Also note that the Send side data is not populated because the message has not been moved out of the send port. Let’s start the send port now and see the result.

5.2.3.Completed Table Values

After starting the send port Business Data/ Milestones at tracepoint2 has been recorded in the BAM Activity Completed table, record gets moved from Active to completed table when the message has been successfully delivered

5.2.4.BAM View

You could also see the ExecutionTime when RcvdTime and SendportTime are also filled.

5.2.5.Full BAM Record View:

This is the full view of all the Data, Milestones and Activity ID

 

6.How Relationships Works

As we get multiple responses back from SAP system for a single Order Request, We need to establish a relationship between the Response messages to request message.

 

The Relationship scenario is applied on top of the Continuation scenario

This kind of 1: N scenario (1 request and Multiple Response), is addressed using Relationships in BAM.

In the above figure,For One Order Request, there may be multiple Responses may arrive from the end system, the relationship between the one request and multiple responses is established using one CommonID which is common between the Inbound and Outbound Order. In our case it will be the OrderID.

Note: Relationship can be established only for the activities which belong to the same views.

6.1.Testing the Relationship Scenario

In our case Relationship will be between Inbound Order versus multiple Outbound Order status.

Lets post the below acknowledgement message on the Outbound Receive location.

The OrderID is being the same for both Inbound and Outbound Orders.

6.1.1.BAM View- Acknowledged

6.1.2.Full BAM View of the Record

You could see the link of InboundOrder Activity on the Related Activities section

6.1.3.BAM View- Processed

Posting another message as Processed Status

6.1.4.BAM View: For Multiple Response messages

On the Inbound activity you could find two related activity of Oubound

  1. Acknowledged
  1. Processed

Relationship of- One Inbound Order with N Outbound Order status is achieved.

By Clicking on the Outbound Order Activity, we can navigate to the corresponding Inbound Order activities easily. This makes the business/Support team to easily monitor the successfully processed orders versus unsuccessful ones.

 

7.BAM Alerts

BAM Alerts are best in class alerting feature, which ships along with BizTalk. Alerts will be triggered based on the conditions which you can set during design time on par the business expectation. Usually the SLA violations are alerted using BAM alerts. If BizTalk system has an SLA to send the message within 20 minutes of received time, the milestones (Received Time and Send Time) will let us know the violation of SLA and the Alert service will run every 30 seconds to evaluate the condition and trigger an alert to the specified Subscribers/ groups.

 

 

8.Conclusion

BAM, Miniature Business Intelligence is a ready-made Business solution for BizTalk Developers for Tracking and reporting. As this IT era, mainly focuses on quick results with less number of resources, BAM will be a Best in fit with a proven track records and many future enhancements will be in BAM to cater the growing demand in near future. I hope this Paper has leveraged on providing you on the basics of BAM.

 

Happy Integrating :)

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
PraiseGood Article Pin
raghavendra24623-Feb-16 22:01
raghavendra24623-Feb-16 22:01 
GeneralRe: Good Article Pin
VIGNESH SUKUMAR23-Feb-16 23:23
VIGNESH SUKUMAR23-Feb-16 23:23 
QuestionReally Awesome articles, amazed by the details you have shared. Pin
Prashant.17044-Apr-15 10:46
Prashant.17044-Apr-15 10:46 
AnswerRe: Really Awesome articles, amazed by the details you have shared. Pin
VIGNESH SUKUMAR5-Apr-15 19:01
VIGNESH SUKUMAR5-Apr-15 19:01 
QuestionWell Wrote. Pin
Anurag Prajesh31-Mar-15 3:42
Anurag Prajesh31-Mar-15 3:42 
AnswerRe: Well Wrote. Pin
VIGNESH SUKUMAR5-Apr-15 19:01
VIGNESH SUKUMAR5-Apr-15 19:01 
GeneralMy vote of 5 Pin
Member 1155074424-Mar-15 0:51
Member 1155074424-Mar-15 0:51 
GeneralRe: My vote of 5 Pin
VIGNESH SUKUMAR26-Mar-15 2:10
VIGNESH SUKUMAR26-Mar-15 2:10 
GeneralGreat Article Pin
RamaKrishna124216-Mar-15 0:15
RamaKrishna124216-Mar-15 0:15 
GeneralRe: Great Article Pin
VIGNESH SUKUMAR26-Mar-15 2:09
VIGNESH SUKUMAR26-Mar-15 2:09 
QuestionGreat Article Pin
Salam Y. ELIAS27-Jan-15 3:52
professionalSalam Y. ELIAS27-Jan-15 3:52 
AnswerRe: Great Article Pin
VIGNESH SUKUMAR27-Jan-15 16:58
VIGNESH SUKUMAR27-Jan-15 16:58 
GeneralRe: Great Article Pin
Salam Y. ELIAS28-Jan-15 4:33
professionalSalam Y. ELIAS28-Jan-15 4:33 
GeneralRe: Great Article Pin
Salam Y. ELIAS28-Jan-15 6:52
professionalSalam Y. ELIAS28-Jan-15 6:52 
GeneralRe: Great Article Pin
Salam Y. ELIAS28-Jan-15 8:37
professionalSalam Y. ELIAS28-Jan-15 8:37 
GeneralRe: Great Article Pin
VIGNESH SUKUMAR6-Feb-15 2:00
VIGNESH SUKUMAR6-Feb-15 2:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.