我知道 MQExplorer GUI 可以显示谁通过某个 channel 连接到某个队列以及有关此连接的其他信息,但我没有在 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);
}
您可以根据需要修改代码段。希望对您有所帮助。
关于java - 通过来自 Java 的 PCF 请求获取连接到 IBM MQ 队列的消费者的 ip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33493121/