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.
I will be discussing about the details as how to use 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. I would be dividing this in three parts.
Enabling Tracking on BizTalk Send and Receive Ports in BizTalk Administration Tool
Developers has 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 the this 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 needs to be aware of the tables involved. I would just like to tell about the below two tables who 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 track 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 below methods to get the routing details, message flow details etc. This DLL is placed in C:\\Program Files \ BizTalk Server 2006.
Apart from this also has few very important methods but they are not of our use in this context.
This DLL could be located as below, in case if you need to develop and out of the Box application you must have the License for the same. Below is the look of this DLL in ILDASM. This is an 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 the you need to enable to tracking of the message only then it will go to the tracking database. Other thing is you should be aware of the database structure of the BizTalk Tracking database. Below is the look at the tracking databases. The database name is
BizTalkDTADB and the
TrackingParts2. Apart from this these are two tables which a developer must look into while developing such kind of solutions.