BizTalk Server General - WMI: MSBTS_ServiceInstanceSuspendedEvent

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server General > December 2005 > WMI: MSBTS_ServiceInstanceSuspendedEvent





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author WMI: MSBTS_ServiceInstanceSuspendedEvent
AnaB

2005-12-29, 5:55 pm

Hello, I'm trying to write a windows service to use a WMI class to send
out an e-mail when a message is suspended. The relevant code is below.
It runs fine, but nothing happends. No event is picked up and the
eventhandler is never entered. Under my "Management Classes" in server
explorer I can see MSBTS_ServiceInstance class. It has plenty of
messages with service status of "Suspended," however I cannot see
MSBTS_ServiceInstanceSuspendedEvent class.
I am a total newbie at BizTalk and WMI, please help!


private void GetSuspendedMessages()
{
// Set up an event watcher and a handler for the
MSBTS_ServiceInstanceSuspendedEvent event
ManagementEventWatcher watcher = new ManagementEventWatcher( new
ManagementScope("\\tx-ec02\\root\\MicrosoftBizTalkServer"), new
EventQuery("SELECT * FROM MSBTS_ServiceInstanceSuspendedEvent") );

watcher.EventArrived += new
EventArrivedEventHandler(EmailErrorMessa
ge);

Console.WriteLine("Received DocSuspendedEvent");

// Start watching for MSBTS_ServiceInstanceSuspendedEvent events
watcher.Start();


private static void EmailErrorMessage(object sender,
EventArrivedEventArgs e)
{
//Lookup MSBTS_ServiceInstanceSuspendedEvent in the BTS04
documentation for additional properties
Console.WriteLine("Received DocSuspendedEvent");
string ErrorID = e.NewEvent["ErrorID"].ToString();
string ErrorCategory = e.NewEvent["ErrorCategory"].ToString();
string ErrorDescription = e.NewEvent["ErrorDescription"].ToString();
string ServiceStatus = e.NewEvent["ServiceStatus"].ToString();
string ServiceInstanceID = e.NewEvent["InstanceID"].ToString();

string mailBody = "ErrorID: " + ErrorID + "\n\n" +
"Error Category: " + ErrorCategory + "\n\n" +
"Error Description: " + ErrorDescription + "\n\n" +
"Service Status: " + ServiceStatus + "\n\n" +
"Service Instance ID: " + ServiceInstanceID;
classes.Email myMail = new
classes.Email(System.Configuration.ConfigurationSettings.AppSettings["adminEmail"],
"BizTalk: Suspended Message", "Text", mailBody);
myMail.sendEmail();
}

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com