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 » CurrentDepth for an Alias Queue?

Post new topic  Reply to topic Goto page Previous  1, 2
 CurrentDepth for an Alias Queue? « View previous topic :: View next topic » 
Author Message
mqtablet
PostPosted: Wed Nov 17, 2010 8:12 am    Post subject: Reply with quote

Acolyte

Joined: 09 Jun 2009
Posts: 71

if you are looking for c# code, here it is.

Code:


public void InquireQueueDepth()
        {
            try
            {
                string qmgrName = "QMGR_NAME";
                string svrconnChannel = "SYSTEM.DEF.SVRCONN";
                string conName = "HOSTNAME(1414)";
                string queueName = "ALIAS_QUEUE_NAME";

                MQQueueManager qmgr = new MQQueueManager(qmgrName, svrconnChannel, conName);
                if (qmgr != null)
                {
                    MQQueue aliasQ = qmgr.AccessQueue(AliasQueueName, MQC.MQOO_INQUIRE + MQC.MQOO_FAIL_IF_QUIESCING);
                    if (aliasQ != null)
                    {
                        if (aliasQ.QueueType == MQC.MQQT_ALIAS)
                        {
                            MQQueue baseQ = qmgr.AccessQueue(aliasQ.BaseQueueName.ToString().Trim(), MQC.MQOO_INQUIRE + MQC.MQOO_FAIL_IF_QUIESCING);
                            if (baseQ != null)
                            {
                                if (baseQ.QueueType == MQC.MQQT_LOCAL)
                                {
                                    string info = "Current queue depth of " + baseQ.Name.ToString().Trim() + " Alias (" + aliasQ.Name.ToString().Trim() + ") : ";
                                    info += baseQ.CurrentDepth.ToString().Trim();
                                    MessageBox.Show(info);
                                }
                                else
                                {
                                    MessageBox.Show("Alias queue not pointing to a local queue and cannot inquire queue depth.");
                                }
                            }
                            baseQ.Close();
                        }
                        else
                        {
                            MessageBox.Show("Queue not an alias queue.");
                        }
                        aliasQ.Close();
                    }
                }
                qmgr.Disconnect();
            }
            catch (MQException MQEx)
            {
                MessageBox.Show(MQEx.Message + "    " + MQEx.ReasonCode.ToString());
            }
        }



Replace the values in bold with your actual values.

string qmgrName = "QMGR_NAME";
string svrconnChannel = "SYSTEM.DEF.SVRCONN";
string conName = "HOSTNAME(1414)";
string queueName = "ALIAS_QUEUE_NAME";

hope that helps.


Last edited by mqtablet on Wed Nov 17, 2010 11:22 am; edited 1 time in total
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Nov 17, 2010 8:25 am    Post subject: Reply with quote

Poobah

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

Of course for any client application, this application presumes that the qmgr is running, and that a listener is listening, and there's a working network.

A server-bindings equivalent "automation" app would work even if the qmgr was not running, and/or listeners were listening.
_________________
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
Vitor
PostPosted: Wed Nov 17, 2010 8:41 am    Post subject: Reply with quote

Grand High Poobah

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

rmalghan wrote:
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).


Why wasn't restarting these listeners part of the recovery process for the queue manager? Not any automated process perhaps but someone recovered the queue manager. They should either have restarted affected applications or paged the support areas for those applications.

rmalghan wrote:
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.


Again, why isn't this part of the normal monitoring for the queue manager? The MQ admins should (and probably do) monitor queues for message backlog. Even if they're not prepared to restart your application listeners, they can page / notify the correct support area.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Nov 17, 2010 10:28 am    Post subject: Reply with quote

Grand High Poobah

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

rmalghan wrote:
So I built this script which checks the que depth every 20-30 minutes.


You seem to have been trying this for a very long time....

http://www.mqseries.net/phpBB2/viewtopic.php?t=48622

I still don't believe it's necessary.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
bruce2359
PostPosted: Wed Nov 17, 2010 10:55 am    Post subject: Reply with quote

Poobah

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

Not necessary and not dependable/accurate.
_________________
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 Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » IBM MQ API Support » CurrentDepth for an Alias Queue?
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.