从Java获取通过PCF请求连接到IBM MQ队列的消费者的ip



我知道MQExplorerGUI可以显示谁通过某个通道连接到某个队列,以及有关该连接的其他信息,但我在PCF中没有从Java中找到任何可以做到这一点的东西。

提前感谢您提供的命令和示例(如果有的话)!

这显示了如何检索conname的示例片段。

// Create the PCF message type for the inquire.
PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_Q_STATUS);
// Add queue name
pcfCmd.addParameter(MQConstants.MQCA_Q_NAME, "MYQ");
// We want Q HANDLE attributes
pcfCmd.addParameter(MQConstants.MQIACF_Q_STATUS_TYPE, MQConstants.MQIACF_Q_HANDLE);
// We want to retrieve only the connection name
pcfCmd.addParameter(MQConstants.MQIACF_Q_STATUS_ATTRS, MQConstants.MQCACH_CONNECTION_NAME);
// Execute the command. The returned object is an array of PCF messages.
PCFMessage[] pcfResponse = pcfCM.agent.send(pcfCmd);
try{
    for(int i = 0; i < pcfResponse.length;i++){
        String name = (String) pcfResponse[i].getParameterValue(MQConstants.MQCACH_CONNECTION_NAME);
        System.out.println("Connection Name: " + name);         
        }
    }catch(Exception ex) {
    System.out.print(ex);
}

您可以根据需要修改代码段。希望能有所帮助。

您在MQ Explorer中看到的是MQSC命令:

DISPLAY QSTATUS(<QName>) TYPE(HANDLE)

因此,您需要查找等效的PCF命令。

最新更新