(Note: What follows is fairly trivial so there's no need to read it unless you are particularly interested)
Some time ago I spotted what I think is a bug in the 1.1 spec and logged this as a JIRA issue to make sure I didn't
forget it.
This is "Error in example 9.3.3.2 "Reconnect to a topic using a durable subscription""
http://java.net/jira/browse/JMS_SPEC-80
Here is what I logged:
--------------------------------------------------------------------------------------------------------------------
Section 9.3.3.2 "Reconnect to a topic using a durable subscription" of the JMS 1.1 specification gives an example of how
a client can reconnect to an existing durable subscription. It says:
"there are some important restrictions to be aware of:
* "The client must be attached to the same Connection.
* "The Destination and subscription name must be the same.
* "If a message selector was specified, it must also be the same.
"If these conditions are not met, then the durable subscription is deleted, and a new subscription is created."
The first of these points is incorrect. The Connection need not be the same. However the client identifier must be the
same as was used when creating the durable subscription originally.
--------------------------------------------------------------------------------------------------------------------
I think this is a pretty trivial spec bug which I think I can go ahead and fix without too much formality. I have
therefore done this,
I've now updated the draft spec with the following updated text, which corrects this error and also updates it to
reflect the fact that a durable subscription may have more than one consumer, and to make a more accurate distinction
between topic, durable subscription and consumer.
The updated draft spec is here:
http://java.net/projects/jms-spec/sources/repository/content/jms2.0/specification/word/JMS20.pdf
Here is the new text:
--------------------------------------------------------------------------------------------------------------------
9.3.3.2. Creating a consumer on an existing durable subscription
Once a durable subscription has been created it will continue to accumulate messages until the subscription is deleted
using the Session method unsubscribe, even if the original consumer is closed leaving no consumer on the durable
subscription.
A client application may create a consumer on an existing durable subscription by calling one of the Session methods
createDurableConsumer or createDurableSubscriber, supplying the same parameters that were specified when the durable
subscription was first created.
/* Create a consumer on an existing durable subscription */
session.createDurableConsumer(newsFeedTopic, "mySubscription");
If there were no consumers on the durable subscription prior to calling this method then any messages which were added
to the subscription whilst it had no consumers will be delivered.
A durable subscription may have more than one active consumer (this was not permitted prior to JMS 2.0). Each message
from the subscription will be delivered to only one of the consumers on that subscription.
When creating a consumer on an existing durable subscription there are some important restrictions to be aware of:
• The Destination and subscription name must be the same as when the durable subscription was first created.
• If the connection's client identifier was set when the durable subscription was first created then the same client
identifier must be set when subsequently creating a consumer on it.
• If a message selector was specified when the durable subscription was first created then the same message selector
must be specified when subsequently creating a consumer on it.
--------------------------------------------------------------------------------------------------------------------
The change log has also been updated by adding B.5.19 "Correction: Reconnecting to a durable subscription (JMS_SPEC-80)"
If you have any comments or corrections please let me know.
Nigel