jms-spec
  1. jms-spec
  2. JMS_SPEC-80

Error in example 9.3.3.2 "Reconnect to a topic using a durable subscription"

    Details

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

      Description

      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.

        Activity

        Hide
        Nigel Deakin added a comment -

        In the JMS 1.1 specification, the whole of this section is

        9.3.3.2. Reconnecting to a topic using a durable subscription

        To re-connect to a topic that has an existing durable subscription, the client program can simply call session.CreateDurableSubscriber again, using the same parameters that it previously used. A client program may be intermittently connected. Using durable subscriptions allows messages to still be available to a client program that consumes from a topic, even though the client program was not continuously connected.

        /* Reconnect to a durable subscription */
        session.createDurableSubscriber(newsFeedTopic,"mySubscription");
        

        This reconnects the client program to the topic, and any messages that arrived while the client was disconnected are delivered.

        However, 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.

        Show
        Nigel Deakin added a comment - In the JMS 1.1 specification, the whole of this section is 9.3.3.2. Reconnecting to a topic using a durable subscription To re-connect to a topic that has an existing durable subscription, the client program can simply call session.CreateDurableSubscriber again, using the same parameters that it previously used. A client program may be intermittently connected. Using durable subscriptions allows messages to still be available to a client program that consumes from a topic, even though the client program was not continuously connected. /* Reconnect to a durable subscription */ session.createDurableSubscriber(newsFeedTopic,"mySubscription"); This reconnects the client program to the topic, and any messages that arrived while the client was disconnected are delivered. However, 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.
        Hide
        Nigel Deakin added a comment - - edited

        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 been updated to add the following new section:

        B.5.19 Correction: Reconnecting to a durable subscription (JMS_SPEC-80)

        In the JMS 1.1 specification, section 9.3.3.2 "Reconnect to a topic using a durable subscription" stated that "the client must be attached to the same Connection". This was incorrect and has been corrected to state that the client must use a connection with the same client identifier.

        In addition this section has been renamed 9.3.3.2 "Creating a consumer on an existing durable subscription" and rewritten to make it clearer.

        Show
        Nigel Deakin added a comment - - edited 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 been updated to add the following new section: B.5.19 Correction: Reconnecting to a durable subscription ( JMS_SPEC-80 ) In the JMS 1.1 specification, section 9.3.3.2 "Reconnect to a topic using a durable subscription" stated that "the client must be attached to the same Connection". This was incorrect and has been corrected to state that the client must use a connection with the same client identifier. In addition this section has been renamed 9.3.3.2 "Creating a consumer on an existing durable subscription" and rewritten to make it clearer.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: