How to send plain text JmsMessage with empty heade

2019-08-16 02:23发布

问题:

I want to send a message to an activeMQ and receive it via MQTT.js in the frontend.

jmsTemplate.convertAndSend("topic", "Hello World!");

I am getting the message, but with a header, that I can not decode.

S�A S�)�x-opt-jms-destQ�x-opt-jms-msg-typeQ Ss�   f    
�/ID:myID@�topic://myTopic@@@@�  j��< St�e Sw�  Hello World!

Now I am trying to remove the header from my message.

This thread mentions the targetClient property, but this doesn't seam to work with a topic: Spring JMS Template - remove RFH Header information

I also found the MessageBuilder, where I should be able to set an empty header, but this MessageBuilder doesn't work with the jmsTemplate. jmsTemplate only supports the MessageCreator, which doesn't support an empty header.

How can I send a JMS Message in plain text without any header?

Thanks for any suggestions.

回答1:

Updating the Queue Broker to work with JMS2 fixed this issue.