4

I know that MQExplorer GUI could show who connected to some queue by some channel and other information about this connection, but I didn't find anything in PCF to do that from Java.

Thanks in advance for commands and examples if they exist!

2 Answers2

3

This shows sample snippet shows how to retrieve the 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);
}

You can modify the snippet per your need. Hope it helps.

Shashi
  • 14,980
  • 2
  • 33
  • 52
0

What you are seeing in MQ Explorer is the MQSC command:

DISPLAY QSTATUS(<QName>) TYPE(HANDLE)

So, you need to look up the equivalent PCF command.

Roger
  • 7,062
  • 13
  • 20