0

I am trying to read an message from IBM message queue using JmsTemplate and displaying the same on console, but when it gets printed I observed the JMS header is also getting attached with my message as follows:

JMSMessage class: jms_text

  JMSType:          null
  JMSDeliveryMode:  1
  JMSExpiration:    0
  JMSPriority:      0
  JMSMessageID:     ID:414d51204d515453414d49313120202056d9be132543786e
  JMSTimestamp:     1462271773270
  JMSCorrelationID: null
  JMSDestination:   null
  JMSReplyTo:       null
  JMSRedelivered:   false
event_log_id    event_id    event_name  event_time  insertion_time  event_args  src_mac src_name    src_util_id s ...

Can someone please help me with the code how to remove this header, I am using Spring Batch in Java and I need to pass the message received from MQ to processor without header.

Manoj
  • 25
  • 6

2 Answers2

0

How do you "display" your message?
If you want to only print the payload, get the text payload from you message and print it something like

TextMessage tm = (TextMessage) message; 
System.out.println(tm.getText());
titou10
  • 2,814
  • 1
  • 19
  • 42
  • Thanks for your reply @titou10, as i have mentioned before i need to pass the message to the processor, so i need to remove the header and retain my message body. – Manoj May 03 '16 at 12:23
0

I'd create an ItemProcessor that is executed before your ItemProcessor and have it remove the header.

Michael Minella
  • 20,843
  • 4
  • 55
  • 67