JMS messages

JMS messages are composed of a header, properties, and a body. JMS defines five types of message body.

JMS messages are composed of the following parts:

    Header
    All messages support the same set of header fields. Header fields contain values that are used by both clients and providers to identify and route messages.

    Properties
    Each message contains a built-in facility to support application-defined property values. Properties provide an efficient mechanism to filter application-defined messages.

    Body
    JMS defines five types of message body that cover the majority of messaging styles currently in use:

      Stream
      A stream of Java primitive values. It is filled and read sequentially.

      Map
      A set of name-value pairs, where names are strings and values are Java primitive types. The entries can be accessed sequentially or randomly by name. The order of the entries is undefined.

      Text
      A message containing a java.lang.String.

      Object
      A message that contains a serializable Java object

      Bytes
      A stream of uninterpreted bytes. This message type is for literally encoding a body to match an existing message format.

The JMSCorrelationID header field is used to link one message with another. It typically links a reply message with its requesting message. JMSCorrelationID can hold a provider-specific message ID, an application-specific String, or a provider-native byte[] value.

  • Message selectors in JMS
    Messages can contain application-defined property values. An application can use message selectors to have a JMS provider filter messages.
  • Mapping JMS messages onto IBM MQ messages
    IBM MQ messages are composed of a Message Descriptor, an optional MQRFH2 header, and a body. The contents of a JMS message are partly mapped and partly copied to an IBM MQ message.
  • JMS message conversion
    Message data conversion in JMS is performed when sending and receiving messages. IBM MQ performs most data conversion automatically. It converts text and numeric data when transferring a message between JMS applications. Text is converted when exchanging a JMSTextMessage between a JMS application and an IBM MQ application.

Parent topic: Writing IBM MQ classes for JMS applications