Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a count of messages on IBM Websphere Queue

Tags:

java

c#

ibm-mq

I'm using XMS (i.e 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.)

like image 834
Ranganatha Avatar asked Sep 28 '22 06:09

Ranganatha


1 Answers

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

like image 191
Shashi Avatar answered Oct 07 '22 16:10

Shashi