[jboss-user] [JBoss Messaging] - Question on understanding durable subsciber

CarstenRudat do-not-reply at jboss.com
Mon Mar 23 16:27:13 EDT 2009


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

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4220414#4220414

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4220414



More information about the jboss-user mailing list