Mapping JMS header fields at send() or publish()

These notes relate to the mapping of JMS fields at send() or publish().

JMSDestination to MQRFH2
This is stored as a string that serializes the salient characteristics of the destination object, so that a receiving JMS can reconstitute an equivalent destination object. The MQRFH2 field is encoded as URI (see Uniform resource identifiers (URIs) for details of the URI notation).
JMSReplyTo to MQMD.ReplyToQ, ReplyToQMgr, MQRFH2
The queue name is copied to the MQMD.ReplyToQ field, and the queue manager name is copied to the ReplyToQMgr fields. The destination extension information (other useful details that are kept in the destination object) is copied into the MQRFH2 field. The MQRFH2 field is encoded as a URI (see Uniform resource identifiers (URIs) for details of the URI notation).
JMSDeliveryMode to MQMD.Persistence
The JMSDeliveryMode value is set by the send() or publish() Method or MessageProducer, unless the Destination Object overrides it. The JMSDeliveryMode value is mapped to the MQMD.Persistence field as follows:
  • JMS value PERSISTENT is equivalent to MQPER_PERSISTENT
  • JMS value NON_PERSISTENT is equivalent to MQPER_NOT_PERSISTENT
If the MQQueue persistence property is not set to WMQConstants.WMQ_PER_QDEF, the delivery mode value is also encoded in the MQRFH2.
JMSExpiration to/from MQMD.Expiry, MQRFH2
JMSExpiration stores the time to expire (the sum of the current time and the time to live), whereas MQMD stores the time to live. Also, JMSExpiration is in milliseconds, but MQMD.Expiry is in tenths of a second.
  • If the send() method sets an unlimited time to live, MQMD.Expiry is set to MQEI_UNLIMITED, and no JMSExpiration is encoded in the MQRFH2.
  • If the send() method sets a time to live that is less than 214748364.7 seconds (about 7 years), the time to live is stored in MQMD.Expiry, and the expiration time (in milliseconds), is encoded as an i8 value in the MQRFH2.
  • If the send() method sets a time to live greater than 214748364.7 seconds, MQMD.Expiry is set to MQEI_UNLIMITED. The true expiration time in milliseconds is encoded as an i8 value in the MQRFH2.
JMSPriority to MQMD.Priority
Directly map JMSPriority value (0-9) onto MQMD priority value (0-9). If JMSPriority is set to a non-default value, the priority level is also encoded in the MQRFH2.
JMSMessageID from MQMD.MessageID
All messages sent from JMS have unique message identifiers assigned by IBM® MQ. The value assigned is returned in the MQMD.MessageId field after the MQPUT call, and is passed back to the application in the JMSMessageID field. The IBM MQ messageId is a 24-byte binary value, whereas the JMSMessageID is a string. The JMSMessageID is composed of the binary messageId value converted to a sequence of 48 hexadecimal characters, prefixed with the characters ID:. JMS provides a hint that can be set to disable the production of message identifiers. This hint is ignored, and a unique identifier is assigned in all cases. Any value that is set into the JMSMessageID field before a send() is overwritten.
If you do require the ability to specify the MQMD.MessageID, you can do this with one of the IBM MQ JMS extensions described in Reading and writing the message descriptor from an IBM MQ classes for JMS application.
JMSTimestamp to MQRFH2
During a send, the JMSTimestamp field is set according to the JVM's clock. This value is set into the MQRFH2. Any value that is set into the JMSTimestamp field before a send() is overwritten. See also the JMS_IBM_PutDate and JMS_IBM_PutTime properties.
JMSType to MQRFH2
This string is set into the MQRFH2 mcd.Type field. If it is in URI format, it can also affect mcd.Set and mcd.Fmt fields.
JMSCorrelationID to MQMD.CorrelId, MQRFH2
The JMSCorrelationID can hold one of the following:
A provider specific message ID
This is a message identifier from a message previously sent or received, and so should be a string of 48 lowercase hexadecimal digits that are prefixed with ID: The prefix is removed, the remaining characters are converted into binary, and then they are set into the MQMD.CorrelId field. No CorrelId value is encoded in the MQRFH2.
A provider-native byte[] value
The value is copied into the MQMD.CorrelId field - padded with nulls, or truncated to 24 bytes if necessary. No CorrelId value is encoded in the MQRFH2.
An application-specific string
The value is copied into the MQRFH2. The first 24 bytes of the string, in UTF8 format, are written into the MQMD.CorrelID.