How to pass XML file to JMS queue

2019-08-01 02:59发布

问题:

I have .xml files and I want to send the content to the JMS queue. In this should I convert this xml to textmessage and send? or is there a way that we can directly send the xml.

And also I'd like to know is it possible to send objects (ex: objects of MyClass.java) to the JMS queue?

Please someone guide me.

回答1:

You can use the TextMessage to send XML. But since the XML is already stored in files, I would look at the possibility to send just the raw byte content, using a BytesMessage. If you go for first alternative, be careful about using correct encoding when redin the file content.

Java objects can definitively be sent as JMS messages, as long as they ar serializable.



标签: xml jms