Transformation and routing with WebSphere MQ Integrator V2

You can use WebSphere(R) MQ Integrator V2 to route or transform messages that are created by a JMS client application, and to send or publish messages to a JMS client.

The WebSphere MQ JMS implementation uses the mcd folder of the MQRFH2 to carry information about the message, as described in The MQRFH2 header. By default, the Message Domain (Msd) property is used to identify whether the message is a text, bytes, stream, map, or object message. This value is set depending on the type of the JMS message.

If the application calls setJMSType, it can set the mcd type field to a value of its choosing. This type field can be read by the WebSphere MQ Integrator message flow, and a receiving JMS application can use the getJMSType method to retrieve its value. This applies to all kinds of JMS message.

When a JMS application creates a text or bytes message, the application can set mcd folder fields explicitly by calling the setJMSType method and passing in a string argument in a special URI format as follows:

mcd://domain/[set]/[type][?format=fmt]

This URI form allows an application to set the mcd to a domain that is not one of the standard jms_xxxx values; for example, to domain mrm. It also allows the application to set any or all of the mcd set, type, and format fields.

The string argument to setJMSType is interpreted as follows:

  1. If the string does not appear to be in the special URI format (it does not start with mcd://), the string is added to the mcd folder as the type field.
  2. If the string starts with mcd://, conforms to the URI format, and the message is a Text or Bytes message, the URI string is split into its constituent parts. The domain part overrides the jms_text or jms_bytes value that would otherwise have been generated, and the remaining parts (if present) are used to set the set, type, and format fields in the mcd. Note that set, type, and format are all optional.
  3. If the string starts with mcd:// and the message is a Map, Stream, or Object message, the setJMSType call throws an exception. So you cannot override the domain, or provide a set or format for these classes of message, but you can provide a type.

When a WebSphere MQ message is received with an Msd domain other than one of the standard jms_xxxx values, it is instantiated as a JMS text or bytes message and a URI-style JMSType is assigned to it. If the format field of the RFH2 is MQFMT_STRING, it becomes a TextMessage; otherwise it becomes a BytesMessage. The receiving application can read this using the getJMSType method.