When creating Java™ Message Service (JMS) subscriptions, it may be that only one message is desired but during testing you receive duplicate messages. Applications using the WebSphere MQ (WMQ) classes for JMS that subscribe to the same topic each receive the same messages. If you have a clustered jvm application subscribing to a topic, you would receive a message for each instance. If your objective is to only receive one message, you may wish to create a cloned subscription. By using a cloned subscription, only one copy of the message is available to the subscribers when a message is published on the topic, regardless of how many applications are using the same subscription.
When using a system containing clustered WebSphere Application Server (WAS) instances, it is possible to allow all members of the cluster to use the same subscription for load balancing and failover. In this model, when a new message is published, the broker forwards the message to one of the clustered WAS instances sharing the subscription.
At WAS v6, this was achieved by setting the "enable clone support" property to true on the WMQ topic connection factory through the WAS admin console.
At WAS v7 and v8, the property "Allow cloned durable subscriptions", when set to "true" on the topic connection factory, enables the clustered WAS instances to share the subscription. Information on this property is available in the WAS information center section: WebSphere MQ messaging provider topic connection factory settings
When using either the WebSphere MQ classes for JMS or the WebSphere MQ Resource Adapter outside of WebSphere Application Server, cloned subscriptions can be enabled by ensuring that the Connection Factory property CLONESUPP is set to the value ENABLED.
Applications using this Connection Factory that create a durable subscription will automatically be given a cloned subscription. This allows the same durable subscription to be opened by multiple applications.
The "Clone Support" functionality is only available for durable subscriptions. It is not available to applications that take out a non-durable subscription.
When a message is published on the topic for which the cloned subscription has been created, only one copy of the message is made available to the subscribers. Applications using a cloned subscription must be running within separate Java Runtime Environments. Applications running within the same Java Runtime Environment cannot use cloned subscriptions.