Ibm mq WebSphere Message Broker-如何发送PCF消息

Ibm mq WebSphere Message Broker-如何发送PCF消息,ibm-mq,broker,Ibm Mq,Broker,我们需要从MB流发出一些MQ命令。 方法是发送一个PCF命令,但我不知道如何创建它。 有什么建议吗? Sebastian.要通过PCF消息向MQ队列管理器发出命令,您可以查看*nix上的/opt/mqm/samp/PCF/samples中的示例,或者您安装MQ的位置。(在Windows上,请尝试“C:\ProgramFiles(x86)\IBM\WebSphere MQ\tools\pcf\samples”) 要发出“from”代理命令,您可以使用Java计算节点并使用提供的Java包com.i

我们需要从MB流发出一些MQ命令。 方法是发送一个PCF命令,但我不知道如何创建它。 有什么建议吗?
Sebastian.

要通过PCF消息向MQ队列管理器发出命令,您可以查看*nix上的/opt/mqm/samp/PCF/samples中的示例,或者您安装MQ的位置。(在Windows上,请尝试“C:\ProgramFiles(x86)\IBM\WebSphere MQ\tools\pcf\samples”)

要发出“from”代理命令,您可以使用Java计算节点并使用提供的Java包com.ibm.mq中的方法,例如发送查询以了解队列管理器上定义了哪些队列:

import com.ibm.mq.headers.pcf.PCFMessageAgent;
import com.ibm.mq.headers.pcf.PCFMessage;
import com.ibm.mq.constants.MQConstants;

try
{
    // local queue manager
    String queueManager = "QMGR_broker"; // local queue manager name 
    PCFMessageAgent agent = new PCFMessageAgent(queueManager);

    // remote queue manager
    String host = "localhost"; // host name of the queue manager machine
    int port = 1414; // default queue manager tcp listener port
    String channel = "SYSTEM.DEF.SVRCONN";//Default channel
    PCFMessageAgent agent = new PCFMessageAgent(host, port, channel);

    // Create the PCF message type for the inquire.
    PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_INQUIRE_Q_NAMES);
    // Queue name = wildcard.
    pcfCmd.addParameter(MQConstants.MQCA_Q_NAME, "*");
    // Queue type = ALL.
    pcfCmd.addParameter(MQConstants.MQIA_Q_TYPE, MQConstants.MQQT_ALL);

    // Execute the command. The returned object is an array of PCF messages.
    PCFMessage[] pcfResponse = pcfCM.agent.send(pcfCmd);

    // e.g. extract the queue names from the response object
    String[] names = (String[])pcfResponse[0].getParameterValue(MQConstants.MQCACF_Q_NAMES);
}
或者,您可以将PCF消息放在队列管理器正在侦听其上事件的MQ队列(SYSTEM.ADMIN.COMMAND.queue,如果您不在z/OS上)。然后,您还需要在消息中定义“回复”队列。您可以通过带有MQOutput节点的代理执行此操作

然而,这意味着您需要知道您想要发送的消息以及它的回复是什么样子的,我认为使用提供的Java示例为您进行消息处理和格式化要容易得多