1 Reply Latest reply on Sep 16, 2002 3:32 AM by Peter Antman

    Internal JBossMQ id

    jweis Newbie

      I am using JBoss 4.0.0alpha with JBossMQ. I have a question regarding
      durable subscriptions. I am allowed to create a durable subscription as
      follows (not in an EJB):

      Context context = new InitialContext(props);
      topicFactory = (TopicConnectionFactory)
      context.lookup("UILConnectionFactory");
      topicConnection = topicFactory.createTopicConnection("test", "test");
      topicSession =
      topicConnection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
      Topic topic = (Topic) context.lookup("topic/Test");
      topicSubscriber = topicSession.createDurableSubscriber(topic, "TheClient");

      I did not specify a ClientID on the TopicConnection so JBoss creates a
      durable subscription with an Internal JBossMQ id. If my
      subscriber then becomes inactive, I can not re-subscribe because any attempt
      to use an Internal JBossMQ id (one that starts with "ID") will throw an exception. This means that any messages that are sent while the durable subscriber is not active can never be picked up. Further more, because the
      durable subscription is stored in the jbossmq-state file, it will continue
      to receive messages that can never be retrieved.

      Should the call to createDurableSubscriber force you to set a valid client
      id first? This way you could avoid the problem altogether when creating a
      durable subscription.

      I am willing to do the work to make the changes, I just wanted to know what others think about this issue.

      The JMS spec says:
      "At the cost of higher overhead, a subscriber can be made durable. A durable
      subscriber registers a durable subscription with a unique identity that is
      retained by JMS. Subsequent subscriber objects with the same identity resume
      the subscription in the state it was left
      by the prior subscriber. If there
      is no active subscriber for a durable subscription, JMS retains the
      subscription's messages until they are received by the subscription or until
      they expire."