问题描述
我想编写一些代码来监视Websphere 7 MQ上的队列大小.这是我想出的代码
I'd like to write some code to monitor the queue size on Websphere 7 MQ.This is the code I've come up with
MQEnvironment.hostname = "10.21.1.19";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SYSTEM.CDEF.SVRCONN";
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES);
MQQueueManager qMgr = new MQQueueManager("MYQMGR");
MQQueue destQueue = qMgr.accessQueue("PUBLISH", MQC.MQOO_INQUIRE);
System.out.println(destQueue.getCurrentDepth());
destQueue.close();
qMgr.disconnect();
我怎么知道频道"是什么?
How do I know what the "Channel" is?
我怎么知道我传递给MQQueueManager的队列管理器名称是什么?
How do I know what the queue manager name is that I pass into MQQueueManager?
还是我应该看看另一个API?
Or is there another API that I should look at?
我需要将其与WRS 7 SIB和MQ配合使用.
I need it work with WRS 7 SIB and MQ.
谢谢杰夫·波特
推荐答案
我使用了WS 7.0.1.1中的jars
I used the jars from WS 7.0.1.1
com.ibm.mq.jarcom.ibm.mq.jmqi.jarcom.ibm.mq.jmqi.system.jarcom.ibm.mq.commonservices.jarcom.ibm.mq.headers..jarcom.ibm.mq.jmqi.remote.jar
com.ibm.mq.jarcom.ibm.mq.jmqi.jarcom.ibm.mq.jmqi.system.jarcom.ibm.mq.commonservices.jarcom.ibm.mq.headers..jarcom.ibm.mq.jmqi.remote.jar
我从"IBM Webshpere MQ资源管理器"(树中的客户端连接"节点)获得了队列管理器名称和通道名称
I got the Queue Manager name and the Channel name from "IBM Webshpere MQ Explorer" (Client Connection node in the tree)
import com.ibm.mq.MQEnvironment;
import com.ibm.mq.MQQueue;
import com.ibm.mq.MQQueueManager;
import com.ibm.mq.constants.CMQC;
int openOptions = CMQC.MQOO_INQUIRE + CMQC.MQOO_FAIL_IF_QUIESCING + CMQC.MQOO_INPUT_SHARED;
MQEnvironment.hostname = "10.2.51.19";
MQEnvironment.port = 1414;
MQEnvironment.channel = "SW1_QM_CH1";
MQQueueManager qMgr = new MQQueueManager("SW1_QM");
MQQueue destQueue = qMgr.accessQueue("E_RETRY", openOptions);
System.out.println("E_RETRY size:" + destQueue.getCurrentDepth());
destQueue.close();
qMgr.disconnect();
希望这可以帮助其他人!
Hope this helps someone else out!
这篇关于Websphere 7 MQueue:如何从Java访问队列深度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!