dcsimg
Message format
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   simarjit_singh
Posted On:   Wednesday, November 26, 2003 08:32 PM

I am sending a message from a JMS client to MQ IBM server. queueConnection = queueConnectionFactory.createQueueConnection(); queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queueSender = queueSession.createSender(queue); message = queueSession.createTextMessage(); message.setText("helll hello hello"); queueSender.send(message); This is creating a message in Hexadecimal format with some extra data and padding. I want the message in purely text format. I was able to make it work using IBM specific class like this //((MQQueue)queue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ); I don't   More>>

I am sending a message from a JMS client to MQ IBM server.

			
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
message = queueSession.createTextMessage();
message.setText("helll hello hello");
queueSender.send(message);

This is creating a message in Hexadecimal format with some extra data and padding.
I want the message in purely text format.

I was able to make it work using IBM specific class
like this
//((MQQueue)queue).setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);





I don't know what it means but it works:)
i want to use just Queue Class from the JMS and not IBM specific class like MQQueue.


Can i get some input on how can i change message format to text for a message or Queuesession.?


Thanks in advance


Simar    <<Less

Re: Message format

Posted By:   Pep_Grifell  
Posted On:   Thursday, December 4, 2003 04:35 AM

Where do you see the message is in hexadecimal ? in MQ Explorer ? It happened the same to me. When you want to see the content of a message is in hexadecimal but I had an MDB listening to a MQ queue and I could read the TextMessage (calling getText() method) in text format.

Re: Message format

Posted By:   Ganesh_Iyer  
Posted On:   Tuesday, December 2, 2003 03:33 PM

Technically speaking the jms layer should not add any padding etc to the message.
I have no idea why it happens.
There is a workaround though. u can use a bytes message instead of a text message.


queueConnection = queueConnectionFactory.createQueueConnection();
queueSession = queueConnection.createQueueSession(false,
Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
BytesMessage message = (BytesMessage) queueSession.createBytesMessage();

String text = "helll hello hello";
message.writeBytes(text.getBytes());

queueSender.send(message);



I doubt whether the mq api would tamper with this payload.
But if it does, then best luck
About | Sitemap | Contact