简体   繁体   中英

How to get a count of messages on IBM Websphere Queue

I'm using XMS (ie IBM Message Services Client for .NET) to connect to IBM MQ and get the messages.

With that said, I wanted to know how to get count of messages on a Queue at any given point of time.

(Explored on IQueueBrowser.GetEnumerator, but it will download the messages onto client.)

XMS .NET is an implementation of JMS specification and JMS specific does not define a method or a property that retrieves count of messages in a queue. Hence XMS does not provide a way to do that.

Anything to do with queue attributes is a provider specific administrative job, so you have to use message provider specific APIs.

But why do you want to know the count of messages? Application should be coded to receive messages continuously. Your application can choose to quit receiving messages when there are no more messages in the queue or wait for further messages. If there are no messages, the receive call will return with null message object. Your application can check for this and decide to make further receive calls or quit.

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM