What is the relationship between types of the sent JMS messages and types of the received JMS messages? Can they be different types?

Rajiv Kanaujia

Theoretically, if you have a single JMS provider, there should be no difference in the message type (for both send and receive). If you have multiple JMS providers, and they are talking to each other through a bridge, then there is a possibility that the message types may differ. The bridge vendor should document these issues.

However, the entire message should be an instance of a class implementing javax.jms.BytesMessage, javax.jms.MapMessage, javax.jms.ObjectMessage, javax.jms.StreamMessage, or javax.jms.TextMessage. Since each of these message types extends the javax.jms.Message interface, they must be of type javax.jms.Message. If there is a custom message, it too should implement javax.jms.Message interface, or any of the five standard message types.