![](/img/trans.png)
[英]How can i change JMS_IBM_MQMD_Format: MQHRF2 to JMS_IBM_MQMD_Format: MQSTR?
[英]How can i set MQMD message context in client WebsphereMQ?
客戶端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);
請參閱示例程序。 如果您安裝到Windows上的默認位置,則位於:
"C:\Program Files (x86)\IBM\WebSphere MQ\tools\jms\samples\simple\SimpleMQMDWrite.java"
或在* NIX平台上:
/opt/mqm/samp/jms/samples/simple/SimpleMQMDWrite.java
轉到WMQ信息中心,然后查找JMSX *和JMS_IBM_ *選擇器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.