HighTechTalks DotNet Forums  

Message queuing in C#

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Message queuing in C# in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
tiger
 
Posts: n/a

Default Message queuing in C# - 09-30-2005 , 01:57 PM






Hi,

I have a question on MS Message queuing.

I would like to check a message queuing to see if there is a message in the
queue. That is if the queue is empty, I would like to send a note to a
textbox.

Thanks
Tiger





Reply With Quote
  #2  
Old   
Ayyappan Nair
 
Posts: n/a

Default Re: Message queuing in C# - 10-02-2005 , 12:29 PM






On Fri, 30 Sep 2005 12:57:17 -0500, tiger wrote:

Quote:
Hi,

I have a question on MS Message queuing.

I would like to check a message queuing to see if there is a message in the
queue. That is if the queue is empty, I would like to send a note to a
textbox.

Thanks
Tiger
Chackout MessageQueue.Peek() method. You would need to call the Peek method
with a zero timeout within a try block and have a catch block for catching
MessageQueueException. Within this check for
MessageQueueErrorCode.IOTimeout error.
Something like

using System.Messaging;

MessageQueue somequeue = new Messageque(".\\somequeue");
try
{
someque.Peek(new TimeSpan(0));
//if it reaches here queue is not empty
}
catch (MessageQueueException ex)
{
if (ex.MessageQueueErrorCode == MessageQueueErrorCode.IOTimeout)
{
//queue is empty
}
}

HTH,
Ayyappan Nair


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.