ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » # of messages in a Queue (C# of VB.NET)

Post new topic  Reply to topic
 # of messages in a Queue (C# of VB.NET) « View previous topic :: View next topic » 
Author Message
jsnagi
PostPosted: Tue Oct 17, 2006 11:35 am    Post subject: # of messages in a Queue (C# of VB.NET) Reply with quote

Newbie

Joined: 17 Oct 2006
Posts: 3

I have this code that gets' and puts' info in the MQ. In this code all I am trying to do is get the # of messages in the Queue, if there are any. And then based on that I want to do some login. Here's the code, that I have and it does not seem to work. Any help on this matter will be greatly appreciated.

+++++++++++++++++++++++++++++++

public void getMessageFromTheQueue()
{
QMgr = new IBM.WMQ.MQQueueManager(_QueueManagerName,_ChannelName,_ConnectionName);
Q = QMgr.AccessQueue(_QueueName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING);
QMsg = new IBM.WMQ.MQMessage();
QMsg.Format = MQC.MQFMT_STRING;
QGetMessageOptions = new IBM.WMQ.MQGetMessageOptions();
try
{
int QCount = Q.CurrentDepth(MQC.MQQA_GET_ALLOWED); //the code fails at this point
Debug.Write(QCount);
Q.Get(QMsg,QGetMessageOptions);
statusBar.Text = ("Received Message: {0}" + QMsg.ReadString(QMsg.MessageLength));
}
catch (System.Exception e)
{
string err = e.Message;
statusBar.Text = ("MQQueue::Get ended with " + err);
}
}
+++++++++++++++++++++++++++++++
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 17, 2006 11:44 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You have to open a queue for Inquire if you want to get the current depth the way you are trying to do it.

Generally, it is a bad idea to make any decisions based on the current depth inside a program that is putting and getting messages.

If you are trying to write a monitoring program, then you should really look at the Inquire Queue PCF command or the DIS QLOCAL MQSC command. Both of those will return you the CURDEPTH of the queue.

But if you are trying to react to queue depth changes, you should really look at Queue Depth Events. There's an entire manual on WebSphere MQ Monitoring and Events. You should start there.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jsnagi
PostPosted: Tue Oct 17, 2006 12:14 pm    Post subject: Reply with quote

Newbie

Joined: 17 Oct 2006
Posts: 3

Thanks for responding... I browsed the IBM.WMQ.PCF / WMQ and WMQAX objects. I was hoping to see something in WMQ.PCF. I so not see anything in there that I can work against to monitor the queue.

I have the Websphere MQ and the .NET document.... nothing listed in it. Can you point me to some specific place where I can find that info? maybe some samples? Please advice.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Oct 17, 2006 12:15 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

A cursory search of this site here will find you a ton of links and some recent threads with sample code.

Please don't be lazy.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jsnagi
PostPosted: Tue Oct 17, 2006 12:27 pm    Post subject: Reply with quote

Newbie

Joined: 17 Oct 2006
Posts: 3



Thankyou.... I'll just do that. Intention is not to be lazy, but to save me some time! I have only been looking for this info and trying to make it work since yesterday. Anyhow, will do the search right now as you sugested.
Back to top
View user's profile Send private message
IanB
PostPosted: Wed Oct 18, 2006 2:13 am    Post subject: Reply with quote

Apprentice

Joined: 13 Oct 2006
Posts: 43

jsnagi wrote:
Thanks for responding... I browsed the IBM.WMQ.PCF / WMQ and WMQAX objects. I was hoping to see something in WMQ.PCF. I so not see anything in there that I can work against to monitor the queue.

I have the Websphere MQ and the .NET document.... nothing listed in it. Can you point me to some specific place where I can find that info? maybe some samples? Please advice.


If you get WMQ.PCF to work, please let us know as I had some serious issues with it but would revisit it if you succeed.

Good luck
Ian
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » # of messages in a Queue (C# of VB.NET)
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.