|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Getting added some character in front of a message |
« View previous topic :: View next topic » |
Author |
Message
|
jeevan |
Posted: Wed Jul 14, 2010 7:11 pm Post subject: Getting added some character in front of a message |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
I am writing a small app on base java api for MQ. I need to put the message in order to test the listner is working. Tivoli can test whether it is listening or not but it can not test whether it is functioning ( responding the request). The app is intended to test the listening is functioning by putting message and checking it replies.
The code snippet is as follows:
Quote: |
// Set up the options on the queue we wish to open...
int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT|MQC.MQOO_INQUIRE;
MQQueue requestQueue = requestQMgr.accessQueue(requestQueueName, openOptions);
// Define a simple MQSeries message, and write some text in UTF format..
//MQMessage hello_world = new MQMessage();
MQMessage requestMsg = new MQMessage();
requestMsg.replyToQueueManagerName = "TESTQMGR";
requestMsg.replyToQueueName = "TEST.QUEUE";
//hello_world.writeUTF("Hello World!");
requestMsg.format =MQC.MQFMT_STRING;
requestMsg.writeUTF("AXXXddddddddddddddd ddddddd dddddddd ");
// specifythe message options...
MQPutMessageOptions pmo = new MQPutMessageOptions(); // accept the defaults, same as MQPMO_DEFAULT
// put the message on the queue
//system_default_local_queue.put(hello_world,pmo);
requestQueue.put(requestMsg,pmo);
|
I am not getting a reply. when I checked the message on the queue after stoppign the listener, I saw that there is "A" added in front of the message.
But when I put the message using amqsput, i can not see "A" in front of the text. Could some of you please help me figure this out why ?
[/quote] |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 14, 2010 7:50 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You used writeUTF. This goes in pair with readUTF. It adds/strips the order byte info in front of the message.
If you want to use a text message just specify MQSC.MQFMT_STRING in the format field and use the write method. Do not use the writeUTF method...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jeevan |
Posted: Thu Jul 15, 2010 4:07 am Post subject: |
|
|
Grand Master
Joined: 12 Nov 2005 Posts: 1432
|
fjb_saper wrote: |
You used writeUTF. This goes in pair with readUTF. It adds/strips the order byte info in front of the message.
If you want to use a text message just specify MQSC.MQFMT_STRING in the format field and use the write method. Do not use the writeUTF method...
Have fun  |
I chagned to writeString method and it worked. Thanks a lot fjb_saper |
|
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
|
|
|
|