Open glassfishrobot opened 12 years ago
@glassfishrobot Commented Reported by @nigeldeakin
@glassfishrobot Commented @nigeldeakin said: The JMS 2.0 public draft (Jan 2013) specified a new feature called "subscription scope" to address this issue. This was configured using a new MDB activation property subscriptionScope. The activation properties clientId and subscriptionName were also amended to support this new feature. Here's the text that the public draft contained:
| Activation property | Description | | clientId | This property may be used to specify the client identifier that will be used when connecting to the JMS provider from which the endpoint (message-driven bean) is to receive messages.
Setting this property is always optional. If subscriptionScope is set (to Instance or Cluster) then this property must not be set. | | subscriptionName | This property only applies to endpoints (message-driven beans) that receive messages published to a topic. It may be used to specify the name of the durable or non-durable subscription.
If subscriptionScope is not set and the subscriptionDurability property is set to NonDurable then the subscriptionName property may be left unset.
If subscriptionScope is set (to Instance or Cluster) then the subscriptionName property may be left unset. A suitable subscription name will be generated automatically if needed.
If subscriptionScope is set to Instance and the subscriptionName property has been specified then the value of the subscriptionName property will be used as part of the subscription name.
If subscriptionScope is set to {[Cluster}
] and the subscriptionName property has been specified then the value of the subscriptionName property will be used as the subscription name.
| | subscriptionScope | The subscriptionScope property only applies to message-driven beans that receive messages published to a topic. It applies to both durable and non-durable subscriptions, as specified using the subscriptionDurability property.
Setting the subscriptionScope property is optional. If this property is set then it must be set to either Instance or Cluster.
For both durable and non-durable subscriptions, setting this property allows the deployer to specify the scope of the subscription that will be used.
instance scope
If the scope is Instance then the resource adapter will create a separate topic subscription for each application server instance into which the message-driven bean is deployed.
cluster scope
If the scope is Cluster, and the message-driven bean is deployed into a clustered application server, then the resource adapter will create a single shared topic subscription for the entire cluster. If the scope is Cluster, and the application server is not clustered, then the resource adapter will create a separate topic subscription for each application server instance into which the message-driven bean is deployed.
Generation of subscription name
The resource adapter will generate a suitable subscription name in the cases where a shared subscription is used.
If the scope is Instance, the subscriptionDurability is Durable and the subscriptionName property has been specified then the resource adapter will use the subscriptionName property as part of the subscription name.
If the scope is {[Cluster}}, the {{subscriptionDurability}] is Durable and the subscriptionName property has been specified then the the resource adapter will use the subscriptionName property as the subscription name. In this case the deployer is responsible to ensuring that the specified subscriptionName is unique to this cluster.
Client identifier
If the subscriptionScope property is specified then clientId must not be specified. Otherwise a deployment error will occur. |
This section contains some additional recommendations as to how the specified ActivationSpec properties should be used in a resource adapter implementation.
This section applies if the subscriptionScope property is not specified.
It is not defined whether a subscriptionDurability of NonDurable should be implemented using a shared or unshared non-durable subscription. If an unshared durable subscription is used then any subscriptionName specified will be ignored.
It is also not not defined whether a subscriptionDurability of NonDurable should be implemented using a shared or unshared durable subscription.
This section applies if the subscriptionScope property is set to Cluster.
It is recommended that a subscriptionDurability of NonDurable be implemented using a shared non-durable subscription.
It is recommended that a subscriptionDurability of Durable be implemented using a shared durable subscription.
If the message-driven bean is deployed into a clustered application server, then the subscription name that is generated should be the same for the same endpoint in each application server instance within the cluster but otherwise unique.
This section applies if the subscriptionScope property is set to Instance.
It is not defined whether a non-durable subscription should be implemented using a shared or unshared non-durable subscription, or whether a durable subscription should be implemented using a shared or unshared durable subscription.
If the subscriptionScope property is set to instance, and the message-driven bean is deployed into a clustered application server, then the subscription name that is generated must be different for every endpoint and for every application server instance.
This section applies if the subscriptionScope property is set to either Instance or Cluster.
It is recommended that the subscription name that is generated includes a unique identifier to ensure that it is unique across other clusters or across other application server instances that are not part of the cluster.
If the application server instance into which the message-driven bean is deployed is not part of a cluster, then that the subscription name that is generated must be must be different for every endpoint and for every application server instance.
In this case it is recommended that the subscription name that is generated includes a unique identifier to ensure that it is as unique as possible across all application server instances.
The subscription name generated by the resource adapter must be a valid JMS subscription name. This means that it must be no longer than 128 characters and must consist only of Java letters or digits (as defined in the Java Language Specification) or the underscore (_), dot (.) or minus characters.
Since a durable subscription can be used to store messages indefinitely it is recommended that its name remains unchanged even if the application server is restarted or reconfigured, or if the application is redeployed.
Since a subscription name may be visible to the user or administrator it is recommended that the subscription name is at least partly human-readable.
The Java EE Connector Architecture (JCA) specification defines a method getInstanceName on javax.resource.spi.BootstrapContext and a method getActivationUniqueName on MessageEndpointFactory. If a scope of Cluster is specified then a suitable subscription name may be obtained by calling the getActivationUniqueName method. If a scope of Instance is specified then a suitable subscription name may be obtained by calling the getInstanceName and getActivationUniqueName methods and concatenating the results.
However if the subscriptionName property and the subscription is durable then the value of this property should be used instead of the value returned by getActivationUniqueName.
The term "application server instance" as used in this section refers to a single application server JVM. The exact meaning of the term "application server cluster" as used in this section is left to the application server to define but is intended to refer to a group of co-operating application server JVMs to which an identical Java EE application may be deployed.
@glassfishrobot Commented @nigeldeakin said: Tagged for review for JMS 2.1
@glassfishrobot Commented @nigeldeakin said: Removing "fix version=2.0" as this issue was removed from the spec
@glassfishrobot Commented Issue-Links: blocks JMS_SPEC-103
@glassfishrobot Commented This issue was imported from java.net JIRA JMS_SPEC-73
This issue was raised on the JMS forum: https://forums.oracle.com/forums/thread.jspa?threadID=2124417 and is being logged here on behalf of that contributor