MQCMD_INQUIRE_CLUSTER_Q_MGR pcf请求不返回群集信息

时间:2016-05-27 09:14:44

标签: ibm-mq

MQCMD_INQUIRE_CLUSTER_Q_MGR不等同于runmqsc DISPLAY CLUSQMGR(*)命令。以下是此命令的输出

display clusqmgr(*)
     4 : display clusqmgr(*)
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_FR1)                        CHANNEL(TO.QM_FR1)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_FR2)                        CHANNEL(TO.QM_FR2)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR1)                        CHANNEL(TO.QM_PR1)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR2)                        CHANNEL(TO.QM_PR2)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR3)                        CHANNEL(TO.QM_PR3)
   CLUSTER(CLUSTER1)                    
AMQ8441: Display Cluster Queue Manager details.
   CLUSQMGR(QM_PR3)                        CHANNEL(TO.QM_PR3)
   CLUSTER(CLUSTER1)                    

我期待在我提供的代码中对PCF进行类似的响应,但我没有得到这些信息。 我尝试了以下代码,但这不会返回群集信息。

PCFMessageAgent agent = new PCFMessageAgent(queueManager);
agent.setCheckResponses(false);
PCFMessage[] responses;
PCFMessage request = new PCFMessage(MQConstants.MQCMD_INQUIRE_CLUSTER_Q_MGR);
request.addParameter(MQConstants.MQCA_CLUSTER_Q_MGR_NAME, queueManager);

responses = agent.send(request);
String clusterName = (String)responses[0].getParameterValue(MQConstants.MQCA_CLUSTER_NAME);
String clusterInfo = (String)responses[0].getParameterValue(MQConstants.MQIACF_CLUSTER_INFO);
logger.info("Cluster Name [" + clusterName + "]");
logger.info("Cluster Information [" + clusterInfo + "]");

最后一行打印出一个空。


所以问题是 如何使用PCF获取此信息?以上输出适用于完整存储库队列管理器。

1 个答案:

答案 0 :(得分:0)

以下代码显示所需信息:

        responses = agent.send(request);
        for(int i=0; i < responses.length; i++) {
            System.out.println("Cluster Queue manager [" + (String)responses[i].getParameterValue(MQConstants.MQCA_CLUSTER_Q_MGR_NAME) + "]");                                  
            System.out.println("Cluster Name [" + (String)responses[i].getParameterValue(MQConstants.MQCA_CLUSTER_NAME) + "]");
            System.out.println("Cluster Channel [" + (String)responses[i].getParameterValue(MQConstants.MQCACH_CHANNEL_NAME) + "]");                                    
        }

输出如下:

Cluster Queue manager [QM1                                             ]
Cluster Name [CLUS1                                           ]
Cluster Channel [TO.QM1              ]