Geeks With Blogs
Jan Schepens Software Developer

The Administration console that is delivered with the installation of BizTalk allows a user to query suspended service instances and resume or terminate them accordingly. However, when you want to go “outside the box”, and I often do :) you might want to consider finding out possibilities of doing those actions yourself, for instance from a web based managing platform. (note: the following methods work for both BTS2006 and 2009)

When you install BizTalk, there is a WMI provider installed on your machine as well, located in the root/MicrosoftBizTalkServer namespace. That namespace actually provides just about every functionality you need for administration purposes. But in this case, I typically want to focus on the MSBTS_ServiceInstance class. (this is a snapshot taken from server explorer in VS2008)

image

If you right click the class and generate an instance, your current project will get an extra class called ROOT.MicrosoftBizTalkServer.MSBTS_ServiceInstance.cs. When you take a look at that class, you will see the three methods that I’m interested in at this moment: Suspend, Resume, and Terminate. Let’s focus on the Terminate example for this case.

If you want to terminate a service instance through WMI (and there are examples of that over the entire web, so let’s NOT get into that deeply), you can simply use the generated class and say something like:

image

When you provide the InstanceID of your service instance, together with the name and server of the BizTalk Management Database of the BizTalk environment you are working on, the generated class will construct the WMI query for you and execute behind the scenes. So what you need to keep in mind with this method is that you need to go through the entire WMI architecture before actually taking an action.

To me, it sounds easier if I could do the same action in a more direct approach to BizTalk. And lucky for both me as the people who read this (at least I hope people read this :)) we can do that!

When you go to the root install directory of BizTalk (typically that’s C:\Program Files\Microsoft BizTalk Server) you will notice an assembly called Microsoft.BizTalk.Operations.dll, which in this case you can compare to a holy grail :) Let’s take a quick peek at the assembly with Reflector:

image

Of course now every still-awake reader notices the same methods I previously stated. And using these methods are of the same ease as the WMI methods. It goes as follows:

image 

Parameters stay the same. Create an instance of the BizTalkOperations class using the servername and database name of the BizTalk Management Database, and terminate your instance using the InstanceID of the Service Instance object.

Not much difference at first sight, but the thing here really is that when using the BizTalk.Operations, you have a more direct database approach to your action, instead of going through the entire WMI system before actually doing something. Sounds like that could save some performance when you would terminate instances with 500 at a time.

Posted on Friday, April 17, 2009 10:08 AM | Back to top


Comments on this post: Terminating BizTalk instances: WMI vs Operations

No comments posted yet.
Your comment:
 (will show your gravatar)
 


Copyright © Jan Schepens | Powered by: GeeksWithBlogs.net | Join free