jms-spec
  1. jms-spec
  2. JMS_SPEC-93

Does changing the noLocal flag when connecting to a durable subscription cause the durable subscription to be deleted?

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 2.0PD, 2.0
    • Labels:
      None

      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 here for the Session method createDurableSubscriber(Topic topic, java.lang.String name, java.lang.String messageSelector, boolean noLocal) 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?

      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.

        Issue Links

          Activity

          Nigel Deakin created issue -
          Nigel Deakin made changes -
          Field Original Value New Value
          Tags pd20-veryminor
          Nigel Deakin made changes -
          Link This issue blocks JMS_SPEC-40 [ JMS_SPEC-40 ]
          Hide
          Nigel Deakin added a comment - - edited

          When I logged this issue I think I was misunderstanding 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.

          Show
          Nigel Deakin added a comment - - edited When I logged this issue I think I was misunderstanding 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.
          Hide
          Nigel Deakin added a comment - - edited

          Following the changes for JMS_SPEC-65, the API docs and spec have been clarified as follows:

          If there are no active consumers on the durable subscription (and no consumed messages from that subscription are still part of a pending transaction or are not yet acknowledged in the session), and this method is used to create a new consumer on that durable subscription, specifying the same name and client identifier (if set) but a different topic or message selector, or, if the client identifier is set, a different noLocal value, then the durable subscription will be deleted and a new one created.

          However if there is an active consumer on the durable subscription (or a consumed message from that subscription is still part of a pending transaction or is not yet acknowledged in the session), and an attempt is made to create an additional consumer, specifying the same name and client identifier (if set) but a different topic or message selector, or, if the client identifier is set, a different noLocal value, then a JMSException or JMSRuntimeException will be thrown.

          Show
          Nigel Deakin added a comment - - edited Following the changes for JMS_SPEC-65 , the API docs and spec have been clarified as follows: If there are no active consumers on the durable subscription (and no consumed messages from that subscription are still part of a pending transaction or are not yet acknowledged in the session), and this method is used to create a new consumer on that durable subscription, specifying the same name and client identifier (if set) but a different topic or message selector, or, if the client identifier is set, a different noLocal value, then the durable subscription will be deleted and a new one created. However if there is an active consumer on the durable subscription (or a consumed message from that subscription is still part of a pending transaction or is not yet acknowledged in the session), and an attempt is made to create an additional consumer, specifying the same name and client identifier (if set) but a different topic or message selector, or, if the client identifier is set, a different noLocal value, then a JMSException or JMSRuntimeException will be thrown.
          Nigel Deakin made changes -
          Tags pd20-veryminor
          Nigel Deakin made changes -
          Tags pd20-added
          Nigel Deakin made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Fix Version/s 2.0 [ 14692 ]
          Resolution Fixed [ 1 ]
          Nigel Deakin made changes -
          Fix Version/s 2.0PD [ 16049 ]
          Nigel Deakin made changes -
          Assignee Nigel Deakin [ nigeldeakin ]

            People

            • Assignee:
              Nigel Deakin
              Reporter:
              Nigel Deakin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: