Author |
Message
|
bazooka |
Posted: Tue Mar 31, 2009 10:59 pm Post subject: How to get the depth of an alias queue? |
|
|
Newbie
Joined: 31 Mar 2009 Posts: 3
|
hi guys, currently, i have this kind of issue, i can us MQC.MQOO_INQUIRE and CurrentDepth()to get the depth of the queue( which is a local queue)
but my program seems cannot work if the queue is a alias queue(the base is also a local queue)
any one knows why and how?
many thanks  |
|
Back to top |
|
 |
Mr Butcher |
Posted: Wed Apr 01, 2009 1:13 am Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
Quote: |
any one knows why and how? |
because it works as documented:
Quote: |
If the object being inquired is an alias queue, the attribute values returned by the MQINQ call are those of the alias queue, and not those of the base queue to which the alias resolves. |
(taken from the APR manual) _________________ Regards, Butcher |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 01, 2009 2:11 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Why are you writing a program to inquire the depth of a queue? |
|
Back to top |
|
 |
zpat |
Posted: Wed Apr 01, 2009 2:52 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Inquire on the base queue name attribute of the alias queue then open the base queue for inquire on queue depth (if you must). |
|
Back to top |
|
 |
gbaddeley |
Posted: Wed Apr 01, 2009 5:10 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
mqjeff wrote: |
Why are you writing a program to inquire the depth of a queue? |
A nice leading question. One of my favourites. Tell us, bazooka. I can almost smell the answer. _________________ Glenn |
|
Back to top |
|
 |
bazooka |
Posted: Wed Apr 01, 2009 5:41 pm Post subject: |
|
|
Newbie
Joined: 31 Mar 2009 Posts: 3
|
haha, i fixed, now i point to the local queue~~
well, I understand this is not a good way to write such a program. but user just request to do it like this...
they just want to use the depth to control the whole flow.....
which i told them, it's not a godo idea. |
|
Back to top |
|
 |
bazooka |
Posted: Wed Apr 01, 2009 5:43 pm Post subject: |
|
|
Newbie
Joined: 31 Mar 2009 Posts: 3
|
but thanks guys, you r cool~ really give me some good points:D |
|
Back to top |
|
 |
kevinf2349 |
Posted: Wed Apr 01, 2009 6:47 pm Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
bazooka wrote: |
haha, i fixed, now i point to the local queue~~
well, I understand this is not a good way to write such a program. but user just request to do it like this...
they just want to use the depth to control the whole flow.....
which i told them, it's not a godo idea. |
Then trigger on depth...use the force Luke! |
|
Back to top |
|
 |
gbaddeley |
Posted: Thu Apr 02, 2009 4:50 pm Post subject: |
|
|
 Jedi Knight
Joined: 25 Mar 2003 Posts: 2538 Location: Melbourne, Australia
|
bazooka wrote: |
well, I understand this is not a good way to write such a program. but user just request to do it like this...
they just want to use the depth to control the whole flow.....
which i told them, it's not a godo idea. |
Be insistent and educate them about how to use MQ. If you let it go, you may regret it in the future. _________________ Glenn |
|
Back to top |
|
 |
Vitor |
Posted: Thu Apr 02, 2009 10:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bazooka wrote: |
but user just request to do it like this... |
Your user should provide a business requirement, not a technical solution.
bazooka wrote: |
they just want to use the depth to control the whole flow.....
which i told them, it's not a godo idea. |
Be sure to read up on the various discussions of this in the forum, so when the program doesn't work as they want you can explain why without having to research it. It'll make you look good.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Apr 03, 2009 8:12 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Application developers not familiar with MQ concepts will assume that they must first determine if there is a message in the queue (MQINQ), and if there is a message, then MQGET the message. Two MQI calls when one would accomplish the same thing, namely: MQGET (with a WAIT - different discussion).
With one call: if there is a message in the queue, the call completes and returns a rc=0 (usually); if not, the call completes and returns a rc=2033 (no message available).
Two calls is twice the workload of one call (if my basic math skills have survived). _________________ 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 |
|
 |
Vitor |
Posted: Fri Apr 03, 2009 9:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
And of course there are those instances when the MQINQ call returns the wrong depth..... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Apr 03, 2009 9:47 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Quote: |
returns the wrong depth... |
Of course, MQINQ always returns the correct depth. The challenge for the developer is understanding what depth means at the precise instant when the MQINQ returned it.
Now, where did I leave those invisible messages...? _________________ 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 |
|
 |
Vitor |
Posted: Fri Apr 03, 2009 10:09 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bruce2359 wrote: |
Of course, MQINQ always returns the correct depth. The challenge for the developer is understanding what depth means at the precise instant when the MQINQ returned it. |
Yes, yes, ok. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|