1 Reply Latest reply on Mar 23, 2009 10:46 PM by gaohoward

    Question on understanding durable subsciber

      Hi all,

      I have a question on duralbe subscriptions. I create subscription with the following code:

      TopicConnectionFactory tcf = ...
      TopicConnection conn = tcf.createTopicConnection(user, pw);
      Topic topic = (Topic) iniCtx.lookup(...);
      TopicSession session = conn.createTopicSession(false, TopicSession.AUTO_ACKNOWLEDGE);
      conn.start();
      TopicSubscriber recv = session.createDurableSubscriber(topic, suscrId);
      


      If anything with my client fails and I cannot stop conn or session and I again try the above code, I will get an error (IllegalStateException "Cannot create a subscriber on the durable subscription since it already has subscriber(s)").

      What could I do now? I tried to unsubscribe, but then, I get a second IllegalStateException "Cannot unsubscribe durable subscription <my subsciption id> since it has active subscribers" (JBM says, that there is an active subscriber... but it's not active, since my client crashed...). If I restart the JBoss Server everythink is ok.

      I cannot find it in the JavaDoc/JEE Tutorial, so I wounder what I'm doing wrong.

      Any advice?
      Thank you,
      Carsten