Back in March I logged this JIRA issue, which I spotted whilst composing updates for the Early Draft.
"Does changing the noLocal flag when connecting to a durable subscription cause the durable subscription to be deleted?"
http://java.net/jira/browse/JMS_SPEC-93
Here's the description:
------------------------------------------------------------------------------
The JMS 1.1 specification, section 6.11.1 "Durable TopicSubscriber" states:
"A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new
topic and/or message selector, or NoLocal attribute. Changing a durable subscription is equivalent to deleting and
recreating it."
However the javadoc at
http://docs.oracle.com/javaee/6/api/javax/jms/Session.html#createDurableSubscriber%28javax.jms.Topic,%20java.lang.String,%20java.lang.String,%20boolean%29
states that
"A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new
topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and
creating a new one."
The latter text uses an almost identical sentence but does not mention the effect of creating a durable subscriber with
a different value of the noLocal flag.
This is contradictory and needs to be clarified. What is the effect if creating a durable subscriber with a different
value of the noLocal flag than was used when the durable subscription was created?
------------------------------------------------------------------------------
When I logged that issue I wrote:
"I propose that we should interpret the javadoc as being correct and change the spec to match. The NoLocal flag
determines whether messages sent using the connection that created the durable subscription should be added to it. Its
significance ceases when the connection is closed. If the second call to createDurableSubscription uses a different
connection then the value of noLocal that it specifies is completely independent of the previous value and does not
render the durable subscription invalid. It is therefore not necessary to delete the durable subscription and create a
new one."
However I think that was based on a misunderstanding of the meaning of the noLocal parameter. A clarified definition of
this parameter is proposed in
http://java.net/jira/browse/JMS_SPEC-65#action_339660 . This proposes we interpret noLocal
as meaning "If noLocal is set to true, and the client identifier is set, then any messages published using this
connection or any other with the same client identifier will not be added to the durable subscription."
In this case the value of noLocal remains a part of the definition of the durable subscription for the whole of its
lifetime. This means that an attempt to activate the durable subscription using a different value of noLocal will
invalidate the subscription, and so should cause the subscription to be deleted and recreated.
If the proposals in
http://java.net/jira/browse/JMS_SPEC-65#action_339660 are approved then I propose that we resolve
*this* issue by doing the opposite of what I first proposed, and to change the javadoc to match the specification.
What do you think?
Nigel