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 Java / JMS » Finding Queue Depth

Post new topic  Reply to topic
 Finding Queue Depth « View previous topic :: View next topic » 
Author Message
SANTYP
PostPosted: Tue Feb 08, 2011 11:33 pm    Post subject: Finding Queue Depth Reply with quote

Centurion

Joined: 27 Mar 2007
Posts: 142

Hi Guys,

I written a program to find the queue depth..
becuase of the prog the number of connections to the queue manager keep on increasing...

I properly closing the the queue and disconnecting the queuemanager

here is the code which I written.. help is highly appreciated.. thanks in advance...

private static void chekQueueDpth(String sQM,String qName,String qDtls,int qDepth)
{
MQQueue q = null;
MQQueueManager qMgr = null;
String qmgr = IniHelper.getIniValue(sQM,"qMgrName");
setMQEnv(sQM);
String[] sRetStatus = new String[1];
int qOptions = MQC.MQOO_INQUIRE ;
try {
qMgr = new MQQueueManager(qmgr);
q = qMgr.accessQueue(qName, qOptions,qmgr, null, null);
int cDepth = q.getCurrentDepth();
// here I have logic to send a mail if depth is more than certain limit
q.close();
qMgr.disconnect();
}
catch (Exception exp) {
try {
q.close();
qMgr.disconnect();
} catch (Exception e2) {
}
sRetStatus[0] = ExceptionUtil.toString(exp);
}

}

setMQEnv(sQM); method:
private static void setMQEnv(String qDataSourceName) {
MQEnvironment.hostname = hostname
MQEnvironment.port = port
MQEnvironment.channel = channel
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,
MQC.TRANSPORT_MQSERIES);
}

please help..

Thanks
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 09, 2011 5:10 am    Post subject: Re: Finding Queue Depth Reply with quote

Grand High Poobah

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

SANTYP wrote:
I written a program to find the queue depth..


This code (which would have been much easier to read if you'd used code tags) seems to be a poor man's queue monitor. Is there nothing better on your site to use, and no better action to take than send someone an email?

How do you know it's your application spinning up the connections?

How is the channel you're using defined?

What does the email logic call?

Does you code run with no exceptions?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
SANTYP
PostPosted: Wed Feb 09, 2011 6:59 am    Post subject: Re: Finding Queue Depth Reply with quote

Centurion

Joined: 27 Mar 2007
Posts: 142

Quote:

no better action to take than send someone an email?

There could be better options but .. I am only finding queue depth of specific queues.. which are critical for me.. (there 6 queues which I always monitor).. if those queues depth increased to certain limit.. I need to send an email to support team.. basically those queues are data has to read by some third party applications.. if that application not read means.. either application has some issue or some other reason.. we need to inform support team.. which is the reason we are sending mails...
Quote:

How do you know it's your application spinning up the connections?


If I stopped the flow in which i written above procedure... connections count is not increasing.. basically.. this flow will be triggered.. every 3 min.. if the flow is in start mode.. i can see there are new connections creating every 3 min... If i stopped the flow... no new connections are creating..

to find the connections i am using following command...
runmqsc qm_name
dis chs(svrconn channel name) all

Quote:

How is the channel you're using defined?

what you meant by how its defined...?

Quote:

Does you code run with no exceptions?

yes
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 09, 2011 7:17 am    Post subject: Re: Finding Queue Depth Reply with quote

Grand High Poobah

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

SANTYP wrote:
we need to inform support team.. which is the reason we are sending mails...


My point is doesn't the support team have an existing method of monitoring queue depths, which they should be using for system critical queues like transmission queues.

SANTYP wrote:
If I stopped the flow in which i written above procedure... connections count is not increasing.. basically.. this flow will be triggered.. every 3 min.. if the flow is in start mode.. i can see there are new connections creating every 3 min... If i stopped the flow... no new connections are creating..


What flow? You're running this in a JCN in a flow?

I think I've found your problem. You said you'd written a program, which to me indicates something stand alone not something inside the WMB environment.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
SANTYP
PostPosted: Wed Feb 09, 2011 7:46 am    Post subject: Re: Finding Queue Depth Reply with quote

Centurion

Joined: 27 Mar 2007
Posts: 142

My point is doesn't the support team have an existing method of monitoring queue depths, which they should be using for system critical queues like transmission queues.[]

no they don't have any access currently... so we have write some custom prog to wakeup them..

Quote:

What flow? You're running this in a JCN in a flow?

I think I've found your problem. You said you'd written a program, which to me indicates something stand alone not something inside the WMB environment.


no its not stand alone.. mentioned method i written inside java compute node...

i am triggering the flow.. every 3 min.. using batch scheduler...
so whenever it got triggered.. its creating a new connection.. and that is not closing...

but in the code.... I am closing the queue and queuemanager as well..

plz help me to go find the issue in the peace of code...
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 09, 2011 7:54 am    Post subject: Re: Finding Queue Depth Reply with quote

Grand High Poobah

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

SANTYP wrote:
no they don't have any access currently... so we have write some custom prog to wakeup them..


So the first time they find out about a downed channel is when someone emails them to ask where their messages are? Or why their application can't send messages because the transmission queue is full? Seriously?

And if they don't have access to these queues, what are they going to do when they get the email you're trying to send? How's that going to work out?

SANTYP wrote:
plz help me to go find the issue in the peace of code...


The issue is not in the code, but the fact you're trying to use a JCN like a container. Make it a true stand alone app, and trigger that with your batch scheduler.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Feb 09, 2011 7:56 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

The issue is that the JVM is not necessarily going to dispose of the connection object, even if you've closed it, until the JVM is disposed.

But regardless, you should be using QDEPTHHI threshold alarms rather than monitoring the queue depth manually.
Back to top
View user's profile Send private message
SANTYP
PostPosted: Wed Feb 09, 2011 8:10 am    Post subject: Re: Finding Queue Depth Reply with quote

Centurion

Joined: 27 Mar 2007
Posts: 142

Quote:

So the first time they find out about a downed channel is when someone emails them to ask where their messages are? Or why their application can't send messages because the transmission queue is full? Seriously?
those queues not transmission queues.. those are normal queues like any other queue we use ... but we post some xml messages on these queues which a trading info... the listing application will allways try to poll on these queues... the listing application running on middletairs.. so some time we are facing some issue with middletairs.. so we have some back middletair.. which will be come into picture when master tair some issues... this is not automated process.. so support team is doing this job currently...


Quote:

The issue is not in the code, but the fact you're trying to use a JCN like a container. Make it a true stand alone app, and trigger that with your batch scheduler.


are suggesting.. standalone prog will server the issue.. If run this prog in standalone.. mode..?
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Feb 09, 2011 8:13 am    Post subject: Re: Finding Queue Depth Reply with quote

Grand High Poobah

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

SANTYP wrote:
those queues not transmission queues.. those are normal queues like any other queue we use ... but we post some xml messages on these queues which a trading info... the listing application will allways try to poll on these queues... the listing application running on middletairs.. so some time we are facing some issue with middletairs.. so we have some back middletair.. which will be come into picture when master tair some issues... this is not automated process.. so support team is doing this job currently...


You can probably hear me hitting my head against the desk from where you are.

I'm not suggesting that these are transmission queues - I'm suggesting that whatever is currently in use on your site to monitor the depth of transmission queues is a much better option than trying to reinvent this wheel.

SANTYP wrote:
are suggesting.. standalone prog will server the issue.. If run this prog in standalone.. mode..?


Why not try it and see? Then see what other problems you encounter. Then ask the support team what they currently use to monitor queue depths and use that.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
SANTYP
PostPosted: Wed Feb 09, 2011 8:17 am    Post subject: Reply with quote

Centurion

Joined: 27 Mar 2007
Posts: 142

okey.. thanks Vitor &mqjeff for your valuable suggestions ... I try and post my outcome... thank you very much once again..
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Feb 09, 2011 8:42 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

You could use support pac MO71 which can process event messages and execute commands when it gets them (like sending an Email).

Event messages can be produced on reaching the defined queue high depth threshold (along with many other types of event).
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 09, 2011 9:25 pm    Post subject: Re: Finding Queue Depth Reply with quote

Grand High Poobah

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

SANTYP wrote:


no its not stand alone.. mentioned method i written inside java compute node...

i am triggering the flow.. every 3 min.. using batch scheduler...
so whenever it got triggered.. its creating a new connection.. and that is not closing...

but in the code.... I am closing the queue and queuemanager as well..

plz help me to go find the issue in the peace of code...


Wrong design. You should be using pcf messages and possibly a collector node... or even better as some suggested a Qdepth High event...

Have fun
_________________
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 Java / JMS » Finding Queue Depth
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.