Introduction
Sometimes, in BizTalk development, a developer needs to develop an out of the box solution for message tracking, etc. Even though the BizTalk Server itself provides an excellent tool such as BAM for Business Analyst (precise to say) and HAT for developer, we encountered the same kind of problem where client wanted us to develop such kind of custom solution to display the message body and message flow.
Background
This document details the use of BAM APIs and message tracking databases used to display the message and its flow. It also details about the message needs to tracked in the Tracking database. Since last year, I am trying to write this article which will guide you about the tracking of messages in the BizTalk Tracking databases and how exactly we used this to create a system which displays the message flow through the end points. I would be dividing this learning basically in three parts
Enabling Tracking on BizTalk Send and Receive Ports in BizTalk Administration Tool
Developers have to make sure that Tracking has been turned on the Send and Receive ports. This step is done to track the messages and as a result of this, the message is inserted in the Tracking Database along with their instance id and activity ids.
Enabling Tracking on the Receive Port
Go To BizTalk Server Administration --> Receive Ports Properties ---> Tracking
Check the options Track Message Bodies and Track Message Properties
Enabling Tracking on the Send Port
Go To BizTalk Server Administration --> Send Ports Properties ---> Tracking
Check the options Track Message Bodies and Track Message Properties.
Database Tables Involved
The developer must also need to be aware of the tables involved. I would just like to tell about the below two tables that stores the data related to message flow and message body.
The dta_ServiceInstances, Tracking_Parts1 and Tracking_Parts2 tables
BizTalk Server Micorsoft.BizTalk.Operations class and their methods
When I worked with the BizTalk Server 2002, the messages were tracked based on the Interchange Id but in the Biztalk server 2004 and onwards the database model of the BizTalk databases has been totally chaged.The BAM APIs helps you a lot to track these messages. Below are the few APIs which will help you to do the same. You need to use Microsoft.BizTalk.Operations
class which has the below methods to get the routing details, message flow details, etc. This DLL is placed in C:\\Program Files \ BizTalk Server 2006.
GetMessage
GetMessageFlow
GetRotingDetails
GetServiceInstance
GetTrackedMessage
Apart from this, it also has few very important methods but they are not of our use in this context.
ResumeInstance
SuspendInstance
TerminateInstance
This DLL could be located as below, in case if you need to develop an out of the Box application you must have the License for the same. Below is the look of this DLL in ILDASM. This is a cool tool provided with Visual Studio which allows you to look at the methods, properties, metadata, etc. of the class.
In order to track the message, you need to enable the tracking of the message, only then it will go to the tracking database. The other thing is that you should be aware of the database structure of the BizTalk Tracking database. Below is a look at the tracking databases. The database name is BizTalkDTADB
and the TrackingParts1
and TrackingParts2
. Apart from this, there are two tables which a developer must look into while developing such kind of solutions.
Summary
Now you have all the high level information, so please go ahead with the development and ping me if any more information is needed.
History
- 5th February, 2009: Initial post