Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strip JMS Headers from TextMessage

 
Sam Gehouse
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is getText() the only alternative?
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sam,

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



Regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic