Count number of messages remaining in private queue 
Author Message
 Count number of messages remaining in private queue

Hi,

My VB.Net application can write  messeges into a private queue ok
Does anyone know how to get the Count ( number of messages) remaining in
private queue?

Thanks in advance for you time.
Quynh

Dim objQueue as New.Messageing.MessageQueue(".\myTransactionalQueue")
objQueue.DefaultPropertiesToSend.Recoverable = True
objQueue.Send(objMessage)
'send data to Message Queue
objQueue.Close()



Mon, 01 Aug 2005 04:35:49 GMT  
 Count number of messages remaining in private queue
You're going to want to perform a peek:

 Dim objQueue as New.Messageing.MessageQueue(".\myTransactionalQueue")

But before we do that, we can check to see if, in fact, there are any
messages in the queue in the first place:

Dim isEmpty as Boolean = objQueue.IsEmpty()

If this comes back true then we don't have to worry about continuing further

If it comes back false then

dim objMessage as Message

objMessage = objQueue.Peek(new TimeSpan(0))

Dim MyCount as Integer

Do While isnothing(objMessage) = True

Mycount = MyCount +1

    objMessage = objQueue.Peak(new TimeSpan(0))

Loop

Also, there is a rich variety of examples in help.  Just seach for MSMQ.

hth


Quote:
> Hi,

> My VB.Net application can write  messeges into a private queue ok
> Does anyone know how to get the Count ( number of messages) remaining in
> private queue?

> Thanks in advance for you time.
> Quynh

> Dim objQueue as New.Messageing.MessageQueue(".\myTransactionalQueue")
> objQueue.DefaultPropertiesToSend.Recoverable = True
> objQueue.Send(objMessage)
> 'send data to Message Queue
> objQueue.Close()



Mon, 01 Aug 2005 16:19:16 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Cannot send message to remote private queue

2. msmq and posting to remote private queue

3. connecting to remote private queues using vb.net

4. Discarding messages in the message queue

5. Adding message loop to Visual Basic 5.0 for private messages

6. HELP: Jobs count in printer queue

7. Private message

8. Private Message Macro

9. Hooking into message queue?

10. Does Exchange Server use MSMQ to queue messages????

11. Message Queue Usage: Advise

12. Message Queuing

 

 
Powered by phpBB® Forum Software