This post was originally published here

I recently brought some old BizTalk Server resources back to life, like the BizTalk Server WCF-Loopback Adapter or File-Z Adapter. And I have been working on several more resources. So today, it is a pleasure to bring back to life again an old tool created by my friend Thiago Almeida (LinkedInTwitter) back in the day he was a BizTalk Server developer:

  • Get Tracked Message tool

This tool allows you to programmatically extract a message body from the BizTalk tracking database using 3 possible ways, as Thiago Almeida mentioned in his original blog post:

  • Operations DLL: this method uses the Microsoft.BizTalk.Operations assembly. This is pretty straightforward. You add a reference to Microsoft.BizTalk.Operations.dll and use the GetTrackedMessage of the BizTalkOperations class. You can also get to the message context using this method. This method is only available for BizTalk Server 2006 and late.
  • SQL: this method uses the bts_GetTrackedMessageParts stored procedure inside the tracking database expects the message GUID and will return the compressed message data. We can then use reflection to invoke the Decompress method of Microsoft.BizTalk.Message.Interop.CompressionStreams class inside Microsoft.BizTalk.Pipeline.dll to decompress the data returned from SQL.
  • And WMI: this method uses the WMI MSBTS_TrackedMessageInstance.SaveToFile method to save the instance to disk. This was the popular method in BizTalk Server 2004 since there were no operations DLL back then.

As some of you know, the body and context of messages in BizTalk are compressed, and rightfully so. However, the actual compression and decompression code are hidden inside an assembly called BTSDBAccessor.dll. This DLL, the BizTalk Database Accessor, is unmanaged and does a lot of work for BizTalk, including accessing the BizTalk databases to send and receive messages.

The application has only one form and expects the following parameters:

  • The message guid of the message you want to extract.
    • You can get this value for example, from the Message Flow
  • The extraction type (Use Operations DLL, Use SQL, Use WMI)
  • Tracking DB server (the BizTalk server name)
  • Tracking DB name (the BizTalk Tracking database name)

Credits

  • Thiago Almeida | Linkedin | The original craetor of this tool.
  • Diogo Formosinho | Linkedin | Member of my team and that help me migrate this tool and that add a more modern look to the tool.

Download

THIS TOOL IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND.

You can download the BizTalk Server GetTrackedMessage tool from GitHub here:

The post BizTalk Server: Get Tracked Message tool appeared first on SANDRO PEREIRA BIZTALK BLOG.