Author |
Message
|
ddm |
Posted: Thu Jan 08, 2004 2:39 pm Post subject: MQ Queue CurrentDepth property in amqmdnet |
|
|
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 |
|
 |
jefflowrey |
Posted: Thu Jan 08, 2004 3:38 pm Post subject: |
|
|
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 |
|
 |
kirani |
Posted: Thu Jan 08, 2004 4:23 pm Post subject: |
|
|
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 |
|
 |
JasonE |
Posted: Fri Jan 09, 2004 1:50 am Post subject: |
|
|
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 |
|
 |
bower5932 |
Posted: Fri Jan 09, 2004 6:30 am Post subject: |
|
|
 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 |
|
 |
ddm |
Posted: Fri Jan 09, 2004 4:28 pm Post subject: |
|
|
Apprentice
Joined: 17 Nov 2003 Posts: 40
|
Thanks to all the MQOO_INQUIRE did it. |
|
Back to top |
|
 |
ddm |
Posted: Tue Jan 13, 2004 3:08 pm Post subject: |
|
|
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 |
|
 |
JasonE |
Posted: Wed Jan 14, 2004 2:00 am Post subject: |
|
|
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 |
|
 |
Rls65 |
Posted: Thu Jan 29, 2004 6:03 am Post subject: |
|
|
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 |
|
 |
ddm |
Posted: Thu Jan 29, 2004 8:10 am Post subject: |
|
|
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 |
|
 |
saju |
Posted: Mon Feb 02, 2004 11:34 am Post subject: |
|
|
 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 |
|
 |
ddm |
Posted: Tue Feb 03, 2004 9:08 am Post subject: |
|
|
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 |
|
 |
saju |
Posted: Tue Feb 03, 2004 9:26 am Post subject: |
|
|
 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 |
|
 |
|