【问题标题】:Get ip of consumers who connected to IBM MQ queue by PCF request from Java通过来自 Java 的 PCF 请求获取连接到 IBM MQ 队列的消费者的 ip
【发布时间】:2016-02-03 06:02:05
【问题描述】:

我知道 MQExplorer GUI 可以显示谁通过某个通道连接到某个队列以及有关此连接的其他信息,但我没有在 PCF 中找到任何可以从 Java 中执行此操作的内容。

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

【问题讨论】:

    标签: java ibm-mq pcf


    【解决方案1】:

    这显示了示例 sn-p 显示如何检索 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);
    }
    

    您可以根据需要修改 sn-p。希望对您有所帮助。

    【讨论】:

    • 它有效。非常感谢 =) 奇怪,我之前也试过,结果是空的。
    【解决方案2】:

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

    DISPLAY QSTATUS(<QName>) TYPE(HANDLE)
    

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

    【讨论】:

      猜你喜欢
      • 2014-06-24
      • 1970-01-01
      • 2017-12-29
      • 1970-01-01
      • 2016-02-18
      • 1970-01-01
      • 2015-10-08
      • 2018-01-22
      • 1970-01-01
      相关资源
      最近更新 更多