Support pack MS0B is a Java PCF interface which will work.
Here's a sample which displays. Here's a sample program which monitors a
channel and also lists queue depth.
-----Original Message-----
From: Panakkal, Hariskumar (SUPP) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 2:29 PM
To: [EMAIL PROTECTED]
Subject: Re: Channel StatusHi,I like to know how can I find out using a java program?I am sorry as I did not mentioned the same.Thanks,Haris.-----Original Message-----
From: Glen Shubert [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 14, 2002 4:19 PM
To: [EMAIL PROTECTED]
Subject: Re: Channel Status
DIS CHSTATUS(channel name)
Glen
"Panakkal, Hariskumar (SUPP)" <[EMAIL PROTECTED]>
Sent by: MQSeries List <[EMAIL PROTECTED]>05/14/2002 04:08 PM
Please respond to MQSeries List
To: [EMAIL PROTECTED]
cc:
Subject: Channel Status
Hi all,
Is there any way to check the MQ Channel Status (Unix)? Like to know
whether the Channel is down or started?
- haris
Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive
ListChannelStatus.PROPERTIES
Description: Binary data
import java.io.*; import java.util.*; import com.ibm.mq.*; import com.ibm.mq.pcf.*; public class ListChannelStatus { private Properties properties = new Properties(); // Contains system settings. //*********************************************************************************************** //** main() //*********************************************************************************************** static public void main(String args[]) { ListChannelStatus lcs = new ListChannelStatus(); try { lcs.init(); lcs.channelStatus(lcs.properties); lcs.queueDepth(lcs.properties); } catch (Exception e) { System.out.println("general exception NOT handled in main"); e.printStackTrace(); } } //*********************************************************************************************** //** method init() //*********************************************************************************************** public void init() throws Exception { // Load system properties from file "properties.ini" FileInputStream fis = new FileInputStream("ListChannelStatus.properties"); properties.load(fis); fis.close(); // List system properties ByteArrayOutputStream baos = new ByteArrayOutputStream(); properties.list(new PrintWriter(baos, true)); System.out.println(baos.toString()); // turn off the mqji messages, since we're handling some of them MQException.log = null; } //*********************************************************************************************** //** method void channelStatus(Properties p) // This method accepts a Properties Oject which contains the details about the // channel whose status is to be monitored // Monitor_IP - the IP or DNS name for the Server which hosts the channel // Monitor_Port - the listening port for the MQSeries Qmgr // Monitor_Channel - svrconn channel used to connect to qmgr being monitored // (this is not necessarily the channel being monitored) // Target_Channel_Name - the channel being monitored // //*********************************************************************************************** public void channelStatus(Properties p) throws Exception { // Set the situation variables String monitorIP = new String(p.getProperty("Monitor_IP")); int monitorPort = Integer.parseInt(p.getProperty("Monitor_Port")); String monitorChannel = new String(p.getProperty("Monitor_Channel")); String targetName = new String(p.getProperty("Target_Channel_Name")); int chlCount = 0; // set up the PCF agent PCFMessageAgent agent; PCFMessage request; PCFMessage [] responses; // build a request request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_CHANNEL_STATUS); // add a parameter designating the name of the channel for which status is requested request.addParameter(CMQCFC.MQCACH_CHANNEL_NAME, targetName); // add a parameter designating the instance type (current) desired request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_TYPE, CMQC.MQOT_CURRENT_CHANNEL); // add a parameter designating the attributes desired, but first... // ...build an array list of attributes desired System.out.println("okay to here"); int [] attrs = { CMQCFC.MQCACH_CHANNEL_NAME, CMQCFC.MQCACH_CONNECTION_NAME, CMQCFC.MQIACH_MSGS, CMQCFC.MQCACH_LAST_MSG_DATE, CMQCFC.MQCACH_LAST_MSG_TIME, CMQCFC.MQIACH_CHANNEL_STATUS }; System.out.println("after attrs"); // ...now add the parameter for these attributes request.addParameter(CMQCFC.MQIACH_CHANNEL_INSTANCE_ATTRS, attrs); try { // connect to the queue manager using the PCFMessageAgent agent = new PCFMessageAgent(); agent.connect(monitorIP, monitorPort, monitorChannel); } catch (Exception e) { throw e; } try { // send the request and collect the responses responses = agent.send(request); for (int i=0; i < responses.length; i++) { // get the channel name and trim the spaces String temp = responses [i].getStringParameterValue(CMQCFC.MQCACH_CHANNEL_NAME); String channelName = temp.trim(); // get the channel name and trim the spaces temp = responses [i].getStringParameterValue(CMQCFC.MQCACH_CONNECTION_NAME); String connectionName = temp.trim(); // get the channel last message date/time temp = responses [i].getStringParameterValue(CMQCFC.MQCACH_LAST_MSG_DATE); String lstMsgDate = temp.trim(); temp = responses [i].getStringParameterValue(CMQCFC.MQCACH_LAST_MSG_TIME); String lstMsgTime = temp.trim(); // get the channel current messages total int totalMsgs = responses [i].getIntParameterValue(CMQCFC.MQIACH_MSGS); // get the channel status int chlStatus = responses [i].getIntParameterValue(CMQCFC.MQIACH_CHANNEL_STATUS); if (chlStatus != CMQCFC.MQCHS_INACTIVE) { System.out.println(" chlStatus = " + chlStatus); chlCount++; } System.out.println ("chl: " + channelName + " IP: " + connectionName + " msgs: " + totalMsgs + " last msg time: " + lstMsgDate + " " + lstMsgTime + " status: " + chlStatus); } System.out.println( targetName + " count=" + chlCount ); } catch (PCFException pcfEx) { switch(pcfEx.reasonCode) { case CMQCFC.MQRCCF_CHL_STATUS_NOT_FOUND: { System.out.println( targetName + " count=" + chlCount ); break; } default: System.out.println("PCF Exception NOT!! handled in ChannelStatus"); throw pcfEx; } } // // finally // { // agent.disconnect(); // } } //*********************************************************************************************** //** method void queueDepth(Properties p) // This method accepts a Properties Oject which contains the details about the // queue whose depth is to be monitored and returns true if an alert is to be sent // Monitor_IP - the IP or DNS name for the Server which hosts the channel // Monitor_Port - the listening port for the MQSeries Qmgr // Monitor_Channel - svrconn channel used to connect to qmgr being monitored // (this is not necessarily the channel being monitored) // Target_Queue_Name - the queue being monitored // //*********************************************************************************************** public void queueDepth(Properties p) throws Exception { // Set the situation variables String monitorIP = new String(p.getProperty("Monitor_IP")); int monitorPort = Integer.parseInt(p.getProperty("Monitor_Port")); String monitorChannel = new String(p.getProperty("Monitor_Channel")); String targetName = new String(p.getProperty("Target_Queue_Name")); int qDepth = 0; // set up the PCF agent PCFMessageAgent agent; PCFMessage request; PCFMessage [] responses; // build a request request = new PCFMessage (CMQCFC.MQCMD_INQUIRE_Q); // add a parameter designating the name of the channel for which status is requested request.addParameter(CMQC.MQCA_Q_NAME, targetName); try { // connect to the queue manager using the PCFMessageAgent agent = new PCFMessageAgent(); agent.connect(monitorIP, monitorPort, monitorChannel); } catch (Exception e) { throw e; } try { // send the request and collect the responses responses = agent.send(request); for (int i=0; i < responses.length; i++) { // get the queue depth qDepth = responses [i].getIntParameterValue(CMQC.MQIA_CURRENT_Q_DEPTH); System.out.println("queue depth of " + targetName + " = " + qDepth); } } catch (PCFException pcfEx) { System.out.println("PCF Exception NOT!! handled in ChannelStatus"); throw pcfEx; } // finally // { // agent.disconnect(); // } } }