开发者

Count messages in an msmq sub-queue

开发者 https://www.devze.com 2023-04-08 13:52 出处:网络
Is there any way (C# or native) of counting the messages in a message queue开发者_如何学JAVA (sub queue).

Is there any way (C# or native) of counting the messages in a message queue开发者_如何学JAVA (sub queue). Using a queue name of "DIRECT=OS:slc11555001\private$\file-queue;retry"

I want to know how many messages are in the sub queue. At the moment I can see using the management console that there are in fact messages in that queue. If the OS can do it, so should I.

MQMgmtGetInfo returns 0xc00e0020 (which is not a documented error code).

I am therefore confused. I am using code from here: http://functionalflow.co.uk/blog/2008/08/27/counting-the-number-of-messages-in-a-message-queue-in/


The error is as follows (from http://support.microsoft.com/kb/304287): MQ_ERROR_UNSUPPORTED_FORMATNAME_OPERATION (0xC00E0020). MQMgmtGetInfo won't understand the subqueue format name.

The retry subqueue only really exists as a logical division of private$\file-queue queue. You can call a count on the file-queue but not subqueues within it.

Cheers John


From the MSDN page on subqueues:

Subqueues are created implicitly, so only the following APIs can be used with subqueues: MQOpenQueue, MQCloseQueue, MQCreateCursor, MQReceiveMessage, MQReceiveMessageByLookupId, MQHandleToFormatName, MQMoveMessage, and MQPathNameToFormatName. Calling any of the other Message Queuing APIs returns an error

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号