Supported Message Types

The table below lists the standard JMS message types that are supported as well as the corresponding information about how to create them and how to set data to and get data from the message body.

For a comprehensive list of the available methods that can be used for get/set or read/write operations, refer to JMS API Reference.

JMS Message Types

Type and Description To create a message of this type, call... To get and set data...

Message—The Message interface is the root interface of all JMS messages. A Message object holds all the standard message header information. It can be sent when a message containing only header information is sufficient.

session.
createMessage()

It is recommended that a message body of one of the following types is defined:

  • Stream
  • Map
  • Text
  • Object
  • Bytes

StreamMessage—Message body contains a stream of Java primitive values. The message body is filled and read sequentially.

session.
createStreamMessage()

Use StreamMessage read and write methods for primitive types. For example, writeBytes(...) and readInt(...).

MapMessage—Message body contains a set of name-value pairs, where the names are string objects, and the values are Java primitives. The pairs can be accessed sequentially or randomly by name.

session.
createMapMessage()

Use MapMessage get and set methods for name-value pairs, where the names are String objects, and the values are primitive data types in the Java programming language. For example, setBoolean(...) and getFloat(...).

TextMessage—Message body contains a java.lang.String. This message type can be used for plain text messages. It can also be used for XML messages if the Solace proprietary message property SOLACE_JMS_
PROP_ISXML
is used.

session.createText
Message(...)

  • Call setText(...) to set the string body of the text message.
  • Call getText(...) to get the string body of the text message.

ObjectMessage—Message body contains a serializable Java object.

session.
createObjectMessage()

  • Call setObject(...) to set the serializable object containing the message’s data
  • Call getObject(...) to get the object containing the message’s data

BytesMessage—Message body contains a stream of uninterpreted bytes.

session.
createBytesMessage()

Use BytesMessage read and write methods. For example, writeUTF(...) and readBytes(...).