[jboss-user] [JBoss Messaging] - Re: JBM Topic Pub-Sub

bdaye42 do-not-reply at jboss.com
Tue Jan 6 10:19:24 EST 2009


I would like to as a follow on question relating to durable subscriptions.  If a durable subscription is created:

MessageConsumer consumer = session.createDurableSubscriber(Topic topic, String name);

The whole point of using durable subscribers is so that messages can be received while the consumer is not connected.  Let us say the consumer above is created in a method and the reference ceases to exist after.  The consumer can still be notified of any messages published to its topic.  However, how can that consumer be closed and unsubscribed?  If you attempt to unsubscribe the durable subscriber:

session.unsubscribe(String name);

an IllegalStateException will be thrown per the JMS 1.1 spec:

"It is erroneous for a client to delete a durable subscription while there is an active MessageConsumer  or TopicSubscriber for the subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the session. "

How then can durable subscriptions ever be deleted?  I understand if you create a new one with the same name and a new topic, it will effectively delete the old one.  Is this the only option?

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

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



More information about the jboss-user mailing list