6 Replies Latest reply on Oct 20, 2002 8:43 PM by joelvogt

    Problem: Multiple Durable Subscriptions on One Client ID

    temafm

      Hi,
      First of all, I am using JBOSS 3.0.2 with JDK 1.3.1_02.
      I am having trouble using multiple subscriptions on the same client id. Here, what I do:

      - I create two durable subscriptions (without message selector) using the same client id.
      - Then I publish three events.

      When I receive the messages, I only get three messages. Shouldn't I get six messages as I created two subscriptions that accept all the messages?

      Thank you.

        • 1. Re: Problem: Multiple Durable Subscriptions on One Client ID
          joelvogt

          I don't think you will be able to use the same client id. After all, the jms server only checks that the messages were delivered to that id, if they are delivered once, then they will not be sent again.

          • 2. Re: Problem: Multiple Durable Subscriptions on One Client ID
            temafm

            That means, we can only have one subscription (without message selector) per client id?

            I again ran my test program with two subscriptions (lets say SUB1 & SUB2), this time WITH message selector, per client id. I published three events. I received the messages that matched my second (SUB2) subscription but did not receive any message for first (SUB1) subscription.

            Then, I swap the creation of subscriptions. That is, I subscribed SUB2 first and then subscribed SUB1 using the same client id. I published same three events. This time I received messages that matched my fist (SUB1) subscription.

            It seems to me, we can only subscribe one subscription per client id but the JMS specs says that we can subscribe multiple subscriptions per client id.

            Any thoughts.

            Thank you.

            • 3. Re: Problem: Multiple Durable Subscriptions on One Client ID
              temafm

              That means, we can only have one subscription (without message selector) per client id?

              I again ran my test program with two subscriptions (lets say SUB1 & SUB2), this time WITH message selector, per client id. I published three events. I received the messages that matched my second (SUB2) subscription but did not receive any message for first (SUB1) subscription.

              Then, I swap the creation of subscriptions. That is, I subscribed SUB2 first and then subscribed SUB1 using the same client id. I published same three events. This time I received messages that matched my fist (SUB1) subscription.

              It seems to me, we can only subscribe one subscription per client id but the JMS specs says that we can subscribe multiple subscriptions per client id.

              Any thoughts.

              Thank you.

              • 4. Re: Problem: Multiple Durable Subscriptions on One Client ID
                joelvogt

                it is my understanding that the opposite is true. That is, one connection per client id. The client id is what is used to determine if a message has been received or not. If you try to reuse it, then how would it know who has got the message yet?

                <spec snip>

                TopicSubscriber. A durable TopicSubscriber can be created by a Session or by a
                TopicSession. JMS retains a record of this durable subscription and insures that
                all messages from the Topic’s publishers are retained until either they are
                acknowledged by this durable subscriber or they have expired.
                Sessions with durable subscribers must always provide the same client
                identifier. In addition, each client must specify a name that uniquely identifies
                (within client identifier) each durable subscription it creates. Only one session
                at a time can have a TopicSubscriber for a particular durable subscription. See
                Section 4.3.2, “Client Identifier,” for more information.
                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.
                Sessions and TopicSessions provide the unsubscribe

                • 5. Re: Problem: Multiple Durable Subscriptions on One Client ID
                  bernd.koecke

                  Hi,

                  > it is my understanding that the opposite is true.
                  > That is, one connection per client id. The client id
                  > is what is used to determine if a message has been
                  > received or not. If you try to reuse it, then how
                  > would it know who has got the message yet?
                  >

                  I think that's not ok. Your spec snip says it, see below. But I think also that some interesting things aren't clear in the spec :)

                  > <spec snip>
                  >
                  > TopicSubscriber. A durable TopicSubscriber can be
                  > created by a Session or by a
                  > TopicSession. JMS retains a record of this durable
                  > subscription and insures that
                  > all messages from the Topic?s publishers are retained
                  > until either they are
                  > acknowledged by this durable subscriber or they have
                  > expired.
                  > Sessions with durable subscribers must always provide
                  > the same client
                  > identifier. In addition, each client must specify a
                  > name that uniquely identifies
                  > (within client identifier) each durable subscription
                  > it creates.

                  I think the clientId and the name identifies a durable subscription. These two subscriptions must come through the same connection with the same clientId but a different name. Then it is possible to have more than one receiver per clientId, wich all must get the messages. And they could have different message selectors.

                  > Only one session
                  > at a time can have a TopicSubscriber for a particular
                  > durable subscription. See
                  > Section 4.3.2, ?Client Identifier,? for more
                  > information.

                  [...]

                  Regards

                  Bernd

                  • 6. Re: Problem: Multiple Durable Subscriptions on One Client ID
                    joelvogt

                    A spec unclear? ;)