JMS supports five message body types, shown below roughly in the order of complexity:
BytesMessage contains a set of bytes in a format determined by the application.
TextMessage is a simple Java string.
StreamMessage contains a stream of Java primitive values.
MapMessage contains a set of name-value pairs.
ObjectMessage contains a Java serialized object.
While, in general, the message type is dictated by the needs of an application, the more complicated types (MapMessage and ObjectMessage) carry a performance cost: the expense of serializing and deserializing the data. The performance cost depends on how simple or how complicated the data is.