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 » mqseries inquire

Post new topic  Reply to topic
 mqseries inquire « View previous topic :: View next topic » 
Author Message
samopr
PostPosted: Thu Nov 09, 2006 6:25 am    Post subject: mqseries inquire Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Thu Nov 09, 2006 6:58 am    Post subject: Reply with quote

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
View user's profile Send private message
kevinf2349
PostPosted: Thu Nov 09, 2006 7:00 am    Post subject: Reply with quote

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
View user's profile Send private message
samopr
PostPosted: Thu Nov 09, 2006 7:17 am    Post subject: Houston - we have success!! Reply with quote

Newbie

Joined: 09 Nov 2006
Posts: 2

perfecto - thank you very much!!
Back to top
View user's profile Send private message
chillicoder
PostPosted: Fri Nov 10, 2006 10:26 am    Post subject: Query for all queue names with .NET Reply with quote

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
View user's profile Send private message Visit poster's website
jefflowrey
PostPosted: Fri Nov 10, 2006 10:35 am    Post subject: Reply with quote

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
View user's profile Send private message
chillicoder
PostPosted: Fri Nov 10, 2006 12:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
fjb_saper
PostPosted: Fri Nov 10, 2006 3:11 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » mqseries inquire
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.