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 » General Discussion » MQ Queue CurrentDepth property in amqmdnet

Post new topic  Reply to topic
 MQ Queue CurrentDepth property in amqmdnet « View previous topic :: View next topic » 
Author Message
ddm
PostPosted: Thu Jan 08, 2004 2:39 pm    Post subject: MQ Queue CurrentDepth property in amqmdnet Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

I am always getting an error when I try to use the MQQueue.CurrentDepth property to return the number of messages inside the queue. The code is very straight forward:

int numMsg = MyQueue.CurrentDepth

anybody encountered the same problem? How do I fix it?

Thanks in advance
Darell
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Thu Jan 08, 2004 3:38 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What error are you getting?

How do you know the error is on the call you posted?

What does the code that connects to the QM and the code that opens the queue look like?

Are you specifiying the Inquire option when opening the queue?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Jan 08, 2004 4:23 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Put try-catch block around your code to catch MQException. Here is a sample code in C#,
Code:

try
{
   int numMsg = MyQueue.CurrentDepth;
}
catch (MQException mqe)
{
System.Console.WriteLine( "MQQueue::CurrentDepth ended with " + mqe.Message );
}

_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
JasonE
PostPosted: Fri Jan 09, 2004 1:50 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

Until Fixpack 6, dont use mqe.Message, as it returns the 'helpful' "Error in the application". Use ToString for fixpack 5 code, and Message afterwards.
Back to top
View user's profile Send private message
bower5932
PostPosted: Fri Jan 09, 2004 6:30 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Without seeing the error, I'd guess that you don't have the queue opened so that you can inquire the current depth. The C define is MQOO_INQUIRE.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
ddm
PostPosted: Fri Jan 09, 2004 4:28 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

Thanks to all the MQOO_INQUIRE did it.
Back to top
View user's profile Send private message
ddm
PostPosted: Tue Jan 13, 2004 3:08 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

JasonE,

Can you elaborate further on this:

"Use ToString for fixpack 5 code, and Message afterwards."

Where do I get the FixPack 5? Can you give me a quick sample on how to display a more user friendly message.

Thanks!
Back to top
View user's profile Send private message
JasonE
PostPosted: Wed Jan 14, 2004 2:00 am    Post subject: Reply with quote

Grand Master

Joined: 03 Nov 2003
Posts: 1220
Location: Hursley

.net support was initially shipped as a unsupported support pack, and then got migrated into the base product at 5.3 csd / fixpack 5. This is downloadable from:
https://www6.software.ibm.com/dl/wsmqcsd/wsmqcsd-p
Note that post fixpack install, you need to either manually register the dll into the GAC, or set up config files to point to the dll - see the memo.ptf

mqe.Message will print out eg. MQRC_NO_MESSAGES_AVAILABLE (or whatever) from fixpack 6, but isnt implemented at fixpack 5, so you get the inherited "Error from application". mqe.ToString will print out the useful info (ReasonCode=2033, CompletionCode=2 or whatever).
Back to top
View user's profile Send private message
Rls65
PostPosted: Thu Jan 29, 2004 6:03 am    Post subject: Reply with quote

Newbie

Joined: 29 Jan 2004
Posts: 7

There is a problem when query QueueDepth on an Alias Queue. Is the queue an alias queue????
Back to top
View user's profile Send private message
ddm
PostPosted: Thu Jan 29, 2004 8:10 am    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

I am not even sure what an Alias Queue is. I hope you can shed light on this. But I think I am trying to get the current depth of just a regular queue.

Thanks!
Back to top
View user's profile Send private message
saju
PostPosted: Mon Feb 02, 2004 11:34 am    Post subject: Reply with quote

Newbie

Joined: 02 Feb 2004
Posts: 9
Location: India

Try this:

QueueMgr QMgr = new QueueMgr();
try{
MQEnvironment.hostname = Host;
MQEnvironment.port = Port;
MQEnvironment.channel = Channel;
// Establishing connection with Queue Manager
QMgr.QMgr = new MQQueueManager(QManager);
}catch (MQException ex) {
....
}

MQQueue qRqst=QMgr .accessQueue(Queuename, MQC.MQOO_FAIL_IF_QUIESCING | MQC.MQOO_INQUIRE, null, null, null);

...
qRqst.getCurrentDepth();


This piece of code is written in Java.
this will help u. It works for me.
_________________
Dreams get you into the future and add excitement to the present...
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
ddm
PostPosted: Tue Feb 03, 2004 9:08 am    Post subject: Reply with quote

Apprentice

Joined: 17 Nov 2003
Posts: 40

Thanks saju! the current depth is already fixed. the "INQUIRE" option did it. (see message thread.) However, I am asking info about an Alias Queue. do you know anything about it?
Back to top
View user's profile Send private message
saju
PostPosted: Tue Feb 03, 2004 9:26 am    Post subject: Reply with quote

Newbie

Joined: 02 Feb 2004
Posts: 9
Location: India

Some extracts from MQSeries information center:

Alias queues
To your program, an alias queue appears to be a queue, but it is really an MQSeries object that you can use to access another queue. This means that more than one program can work with the same queue, accessing it using different names.

Hope this will give you some more information on alias queues.
Have a nice day!!

If you have details on EBCDIC to "extended ASCII" mapping, I appreciate if you can please pass it on to me.

- Saju
_________________
Dreams get you into the future and add excitement to the present...
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » MQ Queue CurrentDepth property in amqmdnet
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.