File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Strip JMS Headers from TextMessage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Strip JMS Headers from TextMessage" Watch "Strip JMS Headers from TextMessage" New topic
Author

Strip JMS Headers from TextMessage

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
You get TextMessage inside onMessage(..) method of Message Driven Bean.

When you do toString() on the textMessage instance, at first, you get JMS headers. After that only, you get your actula message that you put in the queue.

I can always strip out the headers by String parsing. However, is there an elegant way (WebSphere Server Configuration, or MQ configuration, or JMS API) to remove JMS headers from the message so that I only get the actual message and no header?

Hearder is like:
JMS Message class: jms_text
JMSType: null
JMSDeliveryMode: 1
JMSExpiration: 0
JMSPriority: 0
JMSMessageID: ID:414d5120514d444f43444141202020204377126c20001a01
JMSTimestamp: 1132259105100
JMSCorrelationID:null
JMSDestination: null
JMSReplyTo: null
JMSRedelivered: false
JMS_IBM_PutDate:20051117
JMSXAppID:
JMS_IBM_Format:MQSTR
JMS_IBM_PutApplType:6
JMS_IBM_MsgType:8
JMSXUserID:clarkc
JMS_IBM_PutTime:20250510
JMSXDeliveryCount:1
My actual message starts here after all the above headers ........
Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
Is getText() the only alternative?
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Sam,

Using MapMessage(s) rather than TextMessage(s) might help:



Regards.


I think, therefore I exist -- Rene Descartes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Strip JMS Headers from TextMessage