John500
asked on
Help understanding the following statement: MSMQ_.PeekCompleted += new PeekCompletedEventHandler(MSMQ__PeekCompleted)
Greetings:
I'm trying to debug some code that uses the class 'MessageQueue'
The program fails on this line:
MSMQ_.PeekCompleted += new PeekCompletedEventHandler( MSMQ__Peek Completed) ;
...and the method looks like this:
protected void MSMQ__PeekCompleted(object sender, PeekCompletedEventArgs e)
{
((MessageQueue)sender).End Peek(e.Asy ncResult); // ********* LINE 114 ************
Message m = ((MessageQueue)sender).Rec eive();
this.Fire(m.Label, m.Body.ToString());
MainLoop();
}
Hoping to get help understanding what is being done so I can understand why the procedure times out. The error message I get is:
System.Messaging.MessageQu eueExcepti on was unhandled by user code
Message="Timeout for the requested operation has expired."
Source="System.Messaging"
ErrorCode=-2147467259
StackTrace:
at System.Messaging.MessageQu eue.Asynch ronousRequ est.End()
at ProjectObjects.Module1.CCM SMQ.MSMQ__ PeekComple ted(Object sender, PeekCompletedEventArgs e) in C:\Projects\ProjectObjects \Module1\C CMSMQ.cs:l ine 114
at System.Messaging.MessageQu eue.Asynch ronousRequ est.RaiseC ompletionE vent(Int32 result, NativeOverlapped* overlappedPointer)
Thanks!
I'm trying to debug some code that uses the class 'MessageQueue'
The program fails on this line:
MSMQ_.PeekCompleted += new PeekCompletedEventHandler(
...and the method looks like this:
protected void MSMQ__PeekCompleted(object
{
((MessageQueue)sender).End
Message m = ((MessageQueue)sender).Rec
this.Fire(m.Label, m.Body.ToString());
MainLoop();
}
Hoping to get help understanding what is being done so I can understand why the procedure times out. The error message I get is:
System.Messaging.MessageQu
Message="Timeout for the requested operation has expired."
Source="System.Messaging"
ErrorCode=-2147467259
StackTrace:
at System.Messaging.MessageQu
at ProjectObjects.Module1.CCM
at System.Messaging.MessageQu
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The message didn't change much but here is the additional info:
System.Messaging.Message End()
System.Collections.ListDic tionaryInt ernal
Exception raised by MyDomain\John500 / from : SYSTEMXYZ / Version : 123
I used the existing notification routine which made it look like this:
catch (System.Messaging.MessageQ ueueExcept ion exe)
{
NotifException.NotifExcep( exe, NotifyObjects.Notify, "MSMQ - Thread");
return;
}
NotifException.NotifExcep( ......)
{
....
MailMessage mail = new MailMessage();
mail.To.Add("OrgNotificati on" + OrgEmail.InternalDomain);
mail.From = new MailAddress("Account Organization<OrgUserAcc" + OrgEmail.InternalDomain + '>');
mail.Subject = "[MSMQ Excep][" + System.Environment.Machine Name + "][" + user + "] - " + info;
if (except != null)
{
mail.Body = except.Message + "\r\n\r\n";
mail.Body += except.Source + " -- " + except.GetType().AssemblyQ ualifiedNa me + "\r\n\r\n";
mail.Body += except.StackTrace + "\r\n\r\n";
mail.Body += except.TargetSite + "\r\n\r\n";
mail.Body += except.Data;
}
mail.Body += "\r\n\r\nException raised by " + user + " / from : " + System.Environment.Machine Name + " / Version : " + App.Version;
mail.Body += "\r\n\r\nMore info: [" + info + "]";
mail.IsBodyHtml = false;
OrgEmail.SendMail(mail);
if (EvtWindowsEvent)
SaveExceptionInEvt(except, user, info);
...
}
Any thoughts now about why this routine is timing out?
Thanks
System.Messaging.Message End()
System.Collections.ListDic
Exception raised by MyDomain\John500 / from : SYSTEMXYZ / Version : 123
I used the existing notification routine which made it look like this:
catch (System.Messaging.MessageQ
{
NotifException.NotifExcep(
return;
}
NotifException.NotifExcep(
{
....
MailMessage mail = new MailMessage();
mail.To.Add("OrgNotificati
mail.From = new MailAddress("Account Organization<OrgUserAcc" + OrgEmail.InternalDomain + '>');
mail.Subject = "[MSMQ Excep][" + System.Environment.Machine
if (except != null)
{
mail.Body = except.Message + "\r\n\r\n";
mail.Body += except.Source + " -- " + except.GetType().AssemblyQ
mail.Body += except.StackTrace + "\r\n\r\n";
mail.Body += except.TargetSite + "\r\n\r\n";
mail.Body += except.Data;
}
mail.Body += "\r\n\r\nException raised by " + user + " / from : " + System.Environment.Machine
mail.Body += "\r\n\r\nMore info: [" + info + "]";
mail.IsBodyHtml = false;
OrgEmail.SendMail(mail);
if (EvtWindowsEvent)
SaveExceptionInEvt(except,
...
}
Any thoughts now about why this routine is timing out?
Thanks
ASKER
I don't know what it was that corrected itself but I'm not getting this error any longer.
Thanks for input while it lasted.
If you get the chance please check out this question:
https://www.experts-exchange.com/questions/23835057/Understanding-the-Computer-Management-Message-Queuing-interface.html
Thanks for input while it lasted.
If you get the chance please check out this question:
https://www.experts-exchange.com/questions/23835057/Understanding-the-Computer-Management-Message-Queuing-interface.html
if (! errMess.Equals(String.Empt
{
//create or append to error file
}