WebSphere Message Broker-如何发送PCF消息 [英] WebSphere Message Broker - how to send a PCF message

查看:82
本文介绍了WebSphere Message Broker-如何发送PCF消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们需要从MB流发出一些MQ命令。
的方法是发送PCF命令,但是我不知道如何创建它。
任何指针?
Sebastian。

We need to issue some MQ commands from a MB flow. The way to go is to send a PCF command, but I dont know how to create it. Any pointers ? Sebastian.

推荐答案

要通过PCF消息向MQ队列管理器发出命令,您可以查看/中的示例。 * nix上或您安装过MQ的任何地方的opt / mqm / samp / pcf / samples。 (在Windows上,尝试 C:\程序文件(x86)\IBM\WebSphere MQ\工具\pcf\样本)。

To issue commands to an MQ Queue Manager via PCF messages you can look at the examples in /opt/mqm/samp/pcf/samples on *nix or where ever you have installed MQ. (On Windows try "C:\Program Files (x86)\IBM\WebSphere MQ\tools\pcf\samples").

要发出来自代理的命令,您可以使用Java计算节点,并使用提供的Java包com.ibm.mq中的方法,例如将查询发送到找出在队列管理器上定义的队列:

To issue the commands 'from' broker you can use a Java compute node and use methods in the supplied Java package com.ibm.mq, for example sending a query to find out what queues are defined on a queue manager:

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节点的代理来执行此操作。

Alternatively you can put the PCF messages on the MQ queue (SYSTEM.ADMIN.COMMAND.QUEUE if you're on anything but z/OS) that the queue manager is listening for events on. You will then also need to define a 'reply to' queue in your message. You can do this from broker with an MQOutput node.

但是,这意味着您需要了解您要发送的PCF消息的精确格式,它的答复将是什么样子,我认为使用提供的Java示例为您进行消息处理和格式化要容易得多。

However that means you need to know the exact format of the PCF message that you want to send and what it's reply will look like, I think it is much easier to use the provided Java examples to do the message processing and formatting for you.

这篇关于WebSphere Message Broker-如何发送PCF消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆