Geeks With Blogs
Devdutt's Blog My ramblings on just about everything...

In one of my previous posts, I had mentioned Stephen Thomas's BizTalk Server 2004 Convoy Deep Dive article on MSDN. That article mentions a .NET console app that he'd written that “detects zombie orchestrations and writes the zombie message to a file location”.

A couple of months back our Ops guys wanted something like that to use with MOM. So I used Stephen's model in a VBScript file. This script can be configured so that MOM can run it whenever it gets a message suspension event from BizTalk. It might need some proofing, but here it is:

On Error Resume Next

Const wbemFlagReturnImmediately = &h10

Const wbemFlagForwardOnly = &h20

'Replace "DEVWS108" with comma sep list of Prod Machines eg: "Aaron1","Aaron2"

arrComputers = Array("DEVWS108")

For Each strComputer In arrComputers

   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftBizTalkServer")

   'Messages that are Resumable should be Resumed

   Set colItems = objWMIService.ExecQuery("SELECT * FROM MSBTS_ServiceInstance  where ServiceStatus = '4' ", "WQL", _

                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems

    objItem.Resume()

   Next

   'Messages that are Not-Resumable or Completed with Discarded(zombies)

   Set colItems = objWMIService.ExecQuery("SELECT * FROM MSBTS_ServiceInstance  where ServiceStatus = '16' or ServiceStatus = '32'", "WQL", _

                                          wbemFlagReturnImmediately + wbemFlagForwardOnly)

   For Each objItem In colItems

    Set objWMITrackedMsg = GetObject("winmgmts:\\" & strComputer & "\root\MicrosoftBizTalkServer")

    Set colResumableMsgs = objWMITrackedMsg.ExecQuery("SELECT * FROM MSBTS_MessageInstance WHERE ServiceInstanceID = '" & objItem.InstanceID & "'", "WQL", _

                                            wbemFlagReturnImmediately + wbemFlagForwardOnly)

    'change "c:\" to any directory that you want problematic messages to be saved to

    colResumbleMsgs.SaveToFile("c:\")

   Next

Next

Posted on Thursday, October 6, 2005 8:29 AM BizTalk Server 2004 | Back to top


Comments on this post: Saving BizTalk Zombie Messages...

# re: Saving BizTalk Zombie Messages...
Requesting Gravatar...
Hi,

nice scriot, i will definately try tis some time. hopefully in my next biztalk application.

thanks for sharing with us.




--- http://blog.whiztechnologies.co.uk ---=
Left by Genious on Aug 09, 2007 8:53 PM

Your comment:
 (will show your gravatar)


Copyright © Devdutt Patnaik | Powered by: GeeksWithBlogs.net