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 » Enumerating all local queues of a queue manager

Post new topic  Reply to topic
 Enumerating all local queues of a queue manager « View previous topic :: View next topic » 
Author Message
vijeer2001
PostPosted: Tue Apr 20, 2010 9:06 pm    Post subject: Enumerating all local queues of a queue manager Reply with quote

Novice

Joined: 08 Mar 2010
Posts: 16

I'm trying to write a simple tool for monitoring the state of a Queue Manager. One of the things I'd like to monitor is the current queue depth of each local queue. I haven't been able to find a way to programmatically enumerate all of the local queues on a particular Queue Manager. How can this be done in c#
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 20, 2010 9:53 pm    Post subject: Re: Enumerating all local queues of a queue manager Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

vijeer2001 wrote:
I'm trying to write a simple tool for monitoring the state of a Queue Manager.


What prompted you to reinvent this particular wheel?

vijeer2001 wrote:
I haven't been able to find a way to programmatically enumerate all of the local queues on a particular Queue Manager. How can this be done in c#


If you're trying to enumerate the queue objects that belong to a queue manager, you can't. You'll need to use PCF to assemble a list of local queues then parse the list to obtain the details.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Apr 21, 2010 5:28 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9470
Location: US: west coast, almost. Otherwise, enroute.

Quote:
I'm trying to write a simple tool ... haven't been able to find a way...

Have you read through the MQSC manual for commands that can/will return lists of objects based on speciric criteria?

Have you read through the APR and APG for MQ calls that might provide you queue depth?

What have you tried? What were the results?
_________________
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
View user's profile Send private message
beth_carlin
PostPosted: Fri Jul 02, 2010 2:18 pm    Post subject: Reply with quote

Acolyte

Joined: 08 Jun 2004
Posts: 64

// in Java........
MQQueueManager qMgr = new MQQueueManager(qMgrName);

int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE;

MQQueue inputQueue = qMgr.accessQueue(queueName, openOptions, null, null, null);

int queueDepth = inputQueue.getCurrentDepth();
Back to top
View user's profile Send private message
beth_carlin
PostPosted: Fri Jul 02, 2010 2:37 pm    Post subject: Re: Enumerating all local queues of a queue manager Reply with quote

Acolyte

Joined: 08 Jun 2004
Posts: 64

I think from C program, call a script which contains

runmqsc qmrname < ql.mqsc > ql.txt

in file ql.mqsc
put this entry
dis ql(*)

....
parse
...
return

....
the C program can enumerate from ql.txt

Good luck and pls let me know
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Jul 02, 2010 5:13 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Both approaches are equally inadequate for what the original poster asked for.
A better approach is to make the call in pcf and return the queues with curdepth > 0... (see Vitor's post above...)

Support pack ms0b will help you to do that in java. You might want to look into this as a source of good information.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
zpat
PostPosted: Sat Jul 03, 2010 1:46 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

MQINQ can get current depth without using PCF.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Jul 03, 2010 3:15 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

zpat wrote:
MQINQ can get current depth without using PCF.

Sure but you need 1 call per queue name. Not really suited for a monitoring app. You should use the single pcf call that will return all queues with curdepth gt 0). It is also valid on zOS for MQ V6 and above...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
vijeer2001
PostPosted: Thu Jul 08, 2010 2:37 am    Post subject: Reply with quote

Novice

Joined: 08 Mar 2010
Posts: 16

I am able to enumerate all the queues of the queue manager using PCF. But an extra queue with name starting with "AMQ." is getting created each time I enumerate all the queues. Please guide me how to avoid this.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Jul 08, 2010 4:47 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9470
Location: US: west coast, almost. Otherwise, enroute.

AMQ. queue names are queues that are created dynamically by applications opening QModel definitions.

Two types of dynamic queues:
permanent: can hold both persistent and non-persistent messages, and can live beyond the life of the application
temporary: can hold non-persistent messages only, and are summarily deleted when the application ends.

The application decides whether the dynamic queue is to be permanent or temporary by MQOPENing a qmodel that specifies its type.
_________________
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
View user's profile Send private message
vijeer2001
PostPosted: Thu Jul 08, 2010 5:51 am    Post subject: Reply with quote

Novice

Joined: 08 Mar 2010
Posts: 16

Code:

PCFMessageAgent agent = new PCFMessageAgent(strQueManager);

                    // Build the query request.
                    PCFMessage requestMessage = new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_NAMES);
                    requestMessage.AddParameter(MQC.MQCA_Q_NAME, "*");

                    // Send the request and retrieve the response.
                    PCFMessage[] responses = agent.Send(requestMessage);

                    // Retrieve the values requested from the response.
                    string[] queueNames = responses[0].GetStringListParameterValue(CMQCFC.MQCACF_Q_NAMES);


I am using the above code in order to enumerate all the queue names. How can I mention the dynamic queue type(permanent or temporary) in the application
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Jul 08, 2010 5:57 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

INQUIRE Q NAMES only returns the NAME of the queue.

If you need more information you need to do a different PCF command.

Consider a PCF equivalent of "dis q(*) type".
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Jul 08, 2010 5:59 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9470
Location: US: west coast, almost. Otherwise, enroute.

Dynamic queues are named by app programmers by specifying a naming rule.

Possibilities:
1) an absolute name, such as INV23.TEMP.QUEUE - the resulting queue name will be exactly this.
2) a partial name, such as INV23.* - the resulting queue name will be INV23. followed by date/time-stamp data.
3) * - which will result in the AMQ. (or CSQ. on z/OS) queue name - the resulting queue name will be AMQ. followed by date/time-stamp data.

Usually, dynamic queues are not retained (by applications). Many shops prevent (by security rules) AMQ. and CSQ. names, since the queue name cannot be easily attributed to a specific application.

Quote:
MQC.MQCA_Q_NAME, "*"

indicates that you want any/all queue names. You might want to ignore AMQ. names.
_________________
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
View user's profile Send private message
vijeer2001
PostPosted: Thu Jul 08, 2010 6:40 am    Post subject: Reply with quote

Novice

Joined: 08 Mar 2010
Posts: 16

Thanks for your response. I am not very clear on what to do. I have just tried below to explain the scenario better.

Our application is supposed to monitor all application/non-system IBM Websphere queues of a queue manager and report the queues exceeding the specific depth. Please note, the rules for depth limit can be kept at queue level and can vary for different queues.

Now, PCF was the best way we found to retrieve all queues and their corresponding depth at one go, and than we apply the specific depth rules to come-up with an exception report, which is used to raise an alert for support.

Using PCF, system is creating a new AMQ.* queue every time. As per understanding, system is creating a dynamic queue, but how can we make system not to keep it at the end of the process. The application is running once in 30 minute and creating 48 queues in a day. The MQ ADMIN is freaking out

Is there a way we can code to avoid this extra persistant AMQ queue every time? Is there a way system can create the dynamic queue, but should also delete it after the PCF step is completed?
Back to top
View user's profile Send private message
bruce2359
PostPosted: Thu Jul 08, 2010 6:52 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9470
Location: US: west coast, almost. Otherwise, enroute.

Quote:
how can we make system not to keep it at the end of the process.

Are you saying that your monitoring app create the dynamic queue? If so, look at the model queue definition it opens. Make sure it is a temporary dynamic model definition; OR explicitly close the queue with the delete option.
_________________
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
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 » Enumerating all local queues of a queue manager
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.