users@glassfish.java.net

Re: How To Set useSharedSubscriptionInClusteredContainer to false

From: <glassfish_at_javadesktop.org>
Date: Fri, 11 Jun 2010 05:05:10 PDT

(Having problems posting the web version of this posting. Apologies for the multiple emails)

I think the best way to answer this is to start with an explanation of what the "shared subscriptions" feature is, when you might need to set useSharedSubscriptionInClusteredContainer to false, and how to configure it. (Much of this text will be in the next version of the MQ admin guide). I don't know whether this answers your question: it depends on what you are able to change.

The JMSRA Resource Adapter (which is the default RA for JMS in Glassfish) provides a special feature called [i]shared subscriptions[/i] for containers that support clustering, such as Sun Java System GlassFish Enterprise Server. This feature enables clustered containers to share the load of processing messages for topic subscriptions across the instances of a cluster.

This feature is enabled by default when Glassfish is clustered. When it is enabled, the following behaviors apply:

■ Two or more subscriptions on the same topic with the same client id and the same durable subscription name (if the subscription is durable) are considered “shared”; that is, they are treated as a single subscription, with each message being sent to only one of the participating subscriptions.

■ A client id must be set when creating any subscription, even a nondurable subscription (which does not normally require a client id). Attempting to create a subscription without a client id throws an exception.

■ Attempts by multiple connections to use the same client id do not result in an exception, provided that the connections are from different instances in the cluster.

As mentioned above, the shared subscriptions feature is enabled when Glassfish is clustered. In some applications that use [i]nondurable [/i]subscriptions, however, the shared behavior is not desired. In such cases, the useSharedSubscriptionInClusteredContainer property can be set to false to disable the feature.

To [b]disable [/b]this feature, set the property useSharedSubscriptionInClusteredContainer to false on either the ActivationSpec or ManagedConnectionFactory as appropriate:

* For a MDB this feature may be disabled by setting the activation spec property useSharedSubscriptionInClusteredContainer to false.. This is done in exactly the same way as the other activation spec properties, using annotations in the MDB itself or in the deployment descriptors ejb-jar.xml sun-ejb-jar.xml. Alternatively, if the sun-ejb-jar deployment descriptor specifies a connection factory using the <mdb-connection-factory> element then the property can be configured on the connection factory instead (see next paragraph).

* For Glassfish applications creating a non-durable subscription using the JMS API rather than using a MDB, this feature may be disabled by setting the JMSRA resource adapter's connection factory property useSharedSubscriptionInClusteredContainer to false. This is done in exactly the same way as other connection factory properties, using the Glassfish administration tool, the Glassfish asadmin command or the resource descriptor sun-resources.xml.

Only set useSharedSubscriptionInClusteredContainer to false for non-durable subscriptions. The clientID property does not then need to be set.
[Message sent by forum member 'nigeldeakin']

http://forums.java.net/jive/thread.jspa?messageID=473889