Retained publications in IBM MQ classes for JMS

An IBM MQ classes for JMS client can be configured to use retained publications.

A publisher can specify that a copy of a publication must be retained so that it can be sent to future subscribers who register an interest in the topic. This is done in IBM MQ classes for JMS by setting the integer property JMS_IBM_RETAIN to the value 1. Constants have been defined for these values in the com.ibm.msg.client.jms.JmsConstants interface. For example, if you have created a message msg, to set it as a retained publication use the following code:
// set as a retained publication
msg.setIntProperty(JmsConstants.JMS_IBM_RETAIN, JmsConstants.RETAIN_PUBLICATION);
You can now send the message as normal. JMS_IBM_RETAIN can also be queried in a received message. It is therefore possible to query whether a received message is a retained publication. Parent topic: Accessing IBM MQ features from an IBM MQ classes for JMS application