I'm listening to MQ Q's using Spring JMS @JmsListener annotation.
@JmsListener(destination = "${qNmae}",
containerFactory = "jmsListenerContainerFactory2")
public void processMessage(Message<String> msg) throws JMSException {
}
I need to convert Spring Message object into New JMS TextMessage. I know I can put the method parameter of type TextMessage instead of Message and the Spring automatically converts it but then I'm getting immutable object but my code requires me to keep existing headers and add new headers in certain cases. Basically I'm looking for proper way to duplicate the JMS Message/TextMessage object so that I can add my own headers without the JMS Session objects(As I'm using @JmsListener, I don't want to create new sessions myself just for creating new message).