Author |
Message
|
samopr |
Posted: Thu Nov 09, 2006 6:25 am Post subject: mqseries inquire |
|
|
 Newbie
Joined: 09 Nov 2006 Posts: 2
|
Using MQ API via perl, I am trying to look at all queus and am having a hard time finding the way to query all quese without knowing the exact names.
simply put - How can I retrieve all queue names?? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 09, 2006 6:58 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
From the perldoc for MQSeries::Command...
Code: |
use MQSeries;
use MQSeries::Command;
#
# Simplest usage
#
my $command = MQSeries::Command->new
(
QueueManager => 'some.queue.manager',
)
or die("Unable to instantiate command object\n");
@qnames = $command->InquireQueueNames()
or die "Unable to list queue names\n";
foreach my $qname ( @qnames ) {
$attr = $command->InquireQueue
(
QName => $qname,
QAttrs => [qw(
OpenInputCount
OpenOutputCount
CurrentQDepth
)],
) or die "InquireQueue: " . MQReasonToText($command->Reason()) . "\n";
print "QName = $qname\n";
foreach my $key ( sort keys %$attr ) {
print "\t$key => $attr->{$key}\n";
}
}
|
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kevinf2349 |
Posted: Thu Nov 09, 2006 7:00 am Post subject: |
|
|
 Grand Master
Joined: 28 Feb 2003 Posts: 1311 Location: USA
|
Use an * in the name (or as the name for listing all queues) in a MQSC display command or in a PCF command.
.....or do what Jeff says  |
|
Back to top |
|
 |
samopr |
Posted: Thu Nov 09, 2006 7:17 am Post subject: Houston - we have success!! |
|
|
 Newbie
Joined: 09 Nov 2006 Posts: 2
|
perfecto - thank you very much!! |
|
Back to top |
|
 |
chillicoder |
Posted: Fri Nov 10, 2006 10:26 am Post subject: Query for all queue names with .NET |
|
|
Newbie
Joined: 10 Nov 2006 Posts: 2 Location: Mexico, Mexico City
|
Hi everybody,
I'm searching for the same (How can I retrieve all queue names?) but with .NET API.
In the Perl example see a MQSeries::Comand object(?) and that thing has a InquireQueueNames call that retrieves a list of queue names.
i've searched for something similar but found nothing.
I'm using .NET API v5.3 in Windows
Thank yo in advance. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 10, 2006 10:35 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Search here for ".NET" and "PCF". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
chillicoder |
Posted: Fri Nov 10, 2006 12:12 pm Post subject: |
|
|
Newbie
Joined: 10 Nov 2006 Posts: 2 Location: Mexico, Mexico City
|
Thank you for answering!
I searched for the terms you suggested and did the same search in google.
found this references:
http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?message=13880403&cat=9&thread=139418&treeDisplayType=threadmode1&forum=280#13880403
http://cheeso.members.winisp.net/srcview.aspx?dir=MQ&file=Mq.InquireQueueNames.cs
Ok, I've tried and my test app throws this:
Reason: 2033
Reason code: 2033
Message: MQRC_NO_MSG_AVAILABLE
then I looked directly to the exception and found this:
at IBM.WMQ.MQBaseObject.throwNewMQException(Int32 compCode, Int32 reason)\r\n
at IBM.WMQ.MQQueue.Get(MQMessage message, MQGetMessageOptions gmo, Int32 maxMsgSize)\r\n
at IBM.WMQ.MQQueue.Get(MQMessage message, MQGetMessageOptions gmo)\r\n
at IBM.WMQ.PCF.PCFAgent.Send(Int32 command, PCFParameter[] parameters)\r\n
at IBM.WMQ.PCF.PCFMessageAgent.Send(PCFMessage request, Boolean check)\r\n
at IBM.WMQ.PCF.PCFMessageAgent.Send(PCFMessage request)\r\n at ConsoleApplication1.Class1.FindQueueNames(MQQueueManager queueManager) in c:\\....
One thing that I didn't mention is that my client is running on Windows and the MQ is running on Solaris.
As I see that at the end there is a call to a MQQueue.Get, tried so set an unlimited wait time as follows:
PCFMessageAgent agent = new PCFMessageAgent(queueManager);
PCFMessage request= new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_NAMES);
request.AddParameter (MQC.MQCA_Q_NAME, "T*");
request.AddParameter (MQC.MQIA_Q_TYPE, MQC.MQQT_LOCAL);
request.AddParameter (MQC.MQGMO_WAIT, MQC.MQWI_UNLIMITED); /// <= this is my change!!!
PCFMessage[] responses = agent.Send(request);
As in the documentation says "Consider waiting longer for the message.
", but didn't change anything.
How else could I change the timeout? |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Nov 10, 2006 3:11 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
PCFMessageAgent agent = new PCFMessageAgent(queueManager); |
I understand your qmgr is not local... So you need more information when creating the message agent... Read the MS0B manual...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|