|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQMessage and TextMessage objects |
« View previous topic :: View next topic » |
Author |
Message
|
AndyJB444 |
Posted: Wed Nov 09, 2005 11:05 am Post subject: MQMessage and TextMessage objects |
|
|
Newbie
Joined: 03 Nov 2005 Posts: 4 Location: Washington D.C.
|
Hi,
In a Java App I'm trying to put TextMessage objects to a WMQ 5.1 queue. Currently, I can put plain strings on the queue ("mBuf.writeString(xml); "), but these do not have the MQHRF2 format or headers. Can I use the code structure below to utilize TextMessage objects somehow? Thanks!
Code: |
MQQueueManager qMgr = new MQQueueManager(manager);
int openOptions = MQC.MQOO_OUTPUT;
System.out.println("MQmanager-access queue");
MQQueue q = qMgr.accessQueue(queue, openOptions, null, null, null);
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_NONE;
MQMessage mBuf = new MQMessage();
mBuf.clearMessage();
mBuf.correlationId = MQC.MQCI_NONE; // this acts as filter when you browse the queue!
mBuf.messageId = MQC.MQMI_NONE; // if MQMI not set, so everyone can use the queue
mBuf.writeString(xml);
System.out.println("put message to queue");
q.put(mBuf, pmo);
System.out.println("about to close");
q.close();
qMgr.disconnect();
|
|
|
Back to top |
|
 |
bower5932 |
Posted: Wed Nov 09, 2005 12:21 pm Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
If you want the MQRFH2 header on your messages, you'll need to build itself or put your message with JMS. As far as WMQ is concerned, a 'MQSTR' format message is also a JMS TextMessage. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|