1

クライアント WebsphereMQ のどこで MQMD メッセージ コンテキストを設定すればよいですか?

MQQueueConnectionFactory mqConnectionFactory = new MQQueueConnectionFactory();
mqConnectionFactory.setHostName(producerProperties.getProperty("wmq.host"));
mqConnectionFactory.setPort(Integer.valueOf(producerProperties.getProperty("wmq.port")));
mqConnectionFactory.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
mqConnectionFactory.setQueueManager(producerProperties.getProperty("wmq.manager"));
mqConnectionFactory.setChannel("MyChannel");

/**
 * Producer Section
 */
// Getting producer connection from the MQ server and starting it
Connection producerConnection = mqConnectionFactory.createConnection();
System.out.println("Going to start the producer connection...");
producerConnection.start();

// JMS messages are sent and received using a Session.
Session producerSession = producerConnection.createSession(false,
        Session.AUTO_ACKNOWLEDGE);
// Destination represents here our queue(testQ) on the MQ server.
Destination producerDestination = producerSession.createQueue(producerProperties.getProperty("wmq.queue.name"));

// MessageProducer is used for sending messages
MessageProducer producer = producerSession.createProducer(producerDestination1);
//create text message going to send

TextMessage sendingMessage = producerSession.createTextMessage("Hi Welcome");
sendingMessage.setJMSType(queueName);
System.out.println("Sending the message...");



//sending the message
producer.send(sendingMessage);
4

2 に答える 2

1

サンプルプログラムを参照してください。Windows のデフォルトの場所にインストールした場合は、次の場所にあります。

"C:\Program Files (x86)\IBM\WebSphere MQ\tools\jms\samples\simple\SimpleMQMDWrite.java"

または *NIX プラットフォームの場合:

/opt/mqm/samp/jms/samples/simple/SimpleMQMDWrite.java
于 2013-04-11T03:15:24.543 に答える
-1

WMQ インフォメーション センターに移動し、JMSX* および JMS_IBM_* セレクターを検索します。

于 2013-04-11T14:50:31.443 に答える