I am attempting to write an event handler to catch when Biztalk places an item in it’s suspended queue. My code runs without generating any errors, but does not respond to the event. I have looked at several books and samples but have not found the solution. Does anyone have any thoughts on what the problem might be?
Thanks
Brad
Code:Private WithEvents sink As New WbemScripting.SWbemSink Private objWbemServices As WbemScripting.SWbemServices Private Sub SetupEvent() Dim objnet As New IWshRuntimeLibrary.IWshNetwork_Class() Dim wbemLocat As New WbemScripting.SWbemLocator() Dim objWbemEventSource As WbemScripting.SWbemEventSource Dim objWbemObject As WbemScripting.SWbemObject Dim strMachineName As String Try ' local machine name strMachineName = objnet.ComputerName ' register the sink to receive SuspendedQueue hits objWbemServices = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strMachineName & "\Root\MicrosoftBizTalkServer") objWbemServices.Security_.Privileges.Add(WbemScripting.WbemPrivilegeEnum.wbemPrivilegeSecurity) objWbemServices.ExecNotificationQueryAsync(sink, "Select * from DocSuspendedEvent") Catch eException As System.Exception ‘error handling omitted Finally wbemLocat = Nothing objWbemEventSource = Nothing objWbemObject = Nothing End Try End Sub Private Sub sink_OnObjectReady(ByVal objWbemObject As WbemScripting.SWbemObject, ByVal objWbemAsyncContext As WbemScripting.SWbemNamedValueSet) Handles sink.OnObjectReady ‘the event handler - details omitted End Sub




Reply With Quote