I have found some quite conflicting information on the web and I think that each different JMS provider may also alter the answer too.
I'm trying to understand when sending XML into a JMS system (e.g. ActiveMQ) whether I should use a
BytesMessage : I can guarantee that the XML is serialized correctly and the preamble will match the actual encoding. Furthermore I can be sure that the client will be able to get the raw representation correctly.
TextMessage : There are APIs in many of the queue implementations for sending XML easily. I also understand that there are "encoding" information attached to the messages. But I risk encoding the message (and writing it's preamble) in one format and receiving it as another.
Does anyone have a definitive answer, or at least some reasons why you would choose one over the other?