Author |
Message
|
cmkeller |
Posted: Thu May 27, 2010 1:25 pm Post subject: CurrentDepth for an Alias Queue? |
|
|
Apprentice
Joined: 09 Jan 2005 Posts: 41 Location: Queens, NY
|
Is it possible to use the "CurrentDepth" function for an alias queue? I get an error "MQRC_SELECTOR_NOT_FOR_TYPE" when I try, though I did open the queue with the MQOO_INQUIRE option. Am I missing an option, or is it just not doable? _________________ Chaim Mattis Keller
Shadow Financial Services Corp
ckeller@shadowfinancial.com |
|
Back to top |
|
 |
wschutz |
Posted: Thu May 27, 2010 1:29 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
No, but you get get the base queue (target q) name and maybe get its depth. _________________ -wayne |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 27, 2010 1:29 pm Post subject: Re: CurrentDepth for an Alias Queue? |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
cmkeller wrote: |
is it just not doable? |
It's just not doable. An Alias queue has no depth.
You can, with a little ingenuity, find the base queue the alias points to and enquire on the depth of that. This may or may not meet your needs. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
wschutz |
Posted: Thu May 27, 2010 1:37 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Of course, that assumes the alias is pointing to a local queue and not a remote q..... _________________ -wayne |
|
Back to top |
|
 |
Vitor |
Posted: Thu May 27, 2010 1:37 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
wschutz wrote: |
Of course, that assumes the alias is pointing to a local queue and not a remote q..... |
Good point!!!  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu May 27, 2010 1:48 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
The only type of queue that can have messages (and therefore queue depth) is a QLOCAL. The other types of queue definitions are just that - definitions that resolve to local queues.
An alias definition can point to a local queue or to a remote definition. A remote definition can point to a local transmission queue. A model definition resolves to a dynamically created local queue.
It is unfortunate that the documentation refers to aliases and remote definitions as queues, for they are not. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
wschutz |
Posted: Thu May 27, 2010 1:55 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
bruce2359 wrote: |
It is unfortunate that the documentation refers to aliases and remote definitions as queues, for they are not. |
Well, if I can get/put messages to it, that makes it a queue... _________________ -wayne |
|
Back to top |
|
 |
fatherjack |
Posted: Thu May 27, 2010 2:05 pm Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
wschutz wrote: |
Well, if I can get/put messages to it, that makes it a queue... |
But you can't get messages from a remote queue so what does that make it  _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
wschutz |
Posted: Thu May 27, 2010 2:45 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
fatherjack wrote: |
wschutz wrote: |
Well, if I can get/put messages to it, that makes it a queue... |
But you can't get messages from a remote queue so what does that make it  |
Half-a-queue? _________________ -wayne |
|
Back to top |
|
 |
fatherjack |
Posted: Thu May 27, 2010 2:58 pm Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
wschutz wrote: |
Half-a-queue? |
Maybe, but at this time of night after what I've had to drink I'm queueless  _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri May 28, 2010 1:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
wschutz wrote: |
bruce2359 wrote: |
It is unfortunate that the documentation refers to aliases and remote definitions as queues, for they are not. |
Well, if I can get/put messages to it, that makes it a queue... |
Only if the messages are returned in queue-order, rather than stack-order or random-order or other such.
FIFO for life... |
|
Back to top |
|
 |
rmalghan |
Posted: Wed Nov 17, 2010 6:53 am Post subject: Re: CurrentDepth for an Alias Queue? |
|
|
Newbie
Joined: 09 May 2008 Posts: 8
|
cmkellr: did you ever figure this one out. I am trying to figure this out and have not had much luck. If I use the local/base quename, the script I have does return the que depth. But if I use a alias que, I can't seem to figure out how to get the local que name.
Code: |
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INQUIRE + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INPUT_AS_Q_DEF;
MQQueue system_default_local_queue =qMgr.accessQueue(inputQName,openOptions,null,null,null);
int msgText = system_default_local_queue.getCurrentDepth();
|
cmkeller wrote: |
Is it possible to use the "CurrentDepth" function for an alias queue? I get an error "MQRC_SELECTOR_NOT_FOR_TYPE" when I try, though I did open the queue with the MQOO_INQUIRE option. Am I missing an option, or is it just not doable? |
|
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 17, 2010 7:00 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You do not ever ever ever want to inquire on queue depth from within an application performing business logic.
If you are doing anything to try to find out how many messages need to be processed, or whether or not the queue will be full if you put a message, then you are doing entirely the wrong thing and need to go back to your MQ application programming training materials and review.
If you are trying to roll your own monitoring application, then you shouldn't be dealing with alias queues in the first place, you should be only working with qlocals by only asking for qlocals. |
|
Back to top |
|
 |
rmalghan |
Posted: Wed Nov 17, 2010 7:11 am Post subject: |
|
|
Newbie
Joined: 09 May 2008 Posts: 8
|
Here's my situation. I have a IBM application (client) which connects to MQ and picks up messages. Occasionally something happens which causes the application to stop picking up the messages (for example last weekend MQ server crashed and we had to manually restart the listeners when the MQ came back up). So I was trying to monitor the que depth outside of the client application and if I see the que depth above a certain threshold, automatically restart the client listeners. I know I need to work with the client developers to address this issue of not reconnecting when there are issues. But from operational stand point, I need to ensure the que depth is never above a certain threshold.
So I built this script which checks the que depth every 20-30 minutes. It works if I provide the local que name. My MQ admin is saying they will not expose the local que name since it might change. They are telling me to use the alias quename and find the local que name within the script.
Thanks
Ravi
mqjeff wrote: |
You do not ever ever ever want to inquire on queue depth from within an application performing business logic.
If you are doing anything to try to find out how many messages need to be processed, or whether or not the queue will be full if you put a message, then you are doing entirely the wrong thing and need to go back to your MQ application programming training materials and review.
If you are trying to roll your own monitoring application, then you shouldn't be dealing with alias queues in the first place, you should be only working with qlocals by only asking for qlocals. |
|
|
Back to top |
|
 |
mqjeff |
Posted: Wed Nov 17, 2010 7:19 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can write a PCF command to inquire about the QALIAS and then examine the TARGQ parameter to find out the real name. You can then inquire about the real queue.
But your MQ admins probably already have a tool that can monitor the queue depth and generate an alert or take an action - like restarting your listeners. |
|
Back to top |
|
 |
|