You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Marco.Crivellaro" <ma...@gmail.com> on 2013/02/18 13:33:40 UTC

actively close a durable subscription

A typical durable subscriber in my use case is started and stopped manually
frequently (with different message selector) I would like to close the
durable subscription when the consumer is stopped intentionally.
I haven't found anything on how to end a durable subscription in a way
activemq doesn't keep in memory a copy of the message for the subscriber;
how can I achieve this?
I can check for inactive subscribers like described here:
http://activemq.apache.org/manage-durable-subscribers.html but I'd prefer to
actively unsubscribe from the topic.



--
View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: actively close a durable subscription

Posted by "Marco.Crivellaro" <ma...@gmail.com>.
sorry for spamming, I've found what the issue was.

Before deleting the subscriber the session has to be closed:


_nmsSession.Close()
_nmsSession.DeleteDurableConsumer("name")



--
View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609p4663651.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: actively close a durable subscription

Posted by "Marco.Crivellaro" <ma...@gmail.com>.
calling consumer.stop() before deleting the durable subscription works,
thanks.



--
View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609p4663680.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: actively close a durable subscription

Posted by Timothy Bish <ta...@gmail.com>.
On 02/18/2013 04:27 PM, Marco.Crivellaro wrote:
> I've just realized calling DeleteDurableConsumer throws following error:
>
> ex = {"javax.jms.JMSException : Durable consumer is in use"}
>
>
> how can I stop the consumer before deleting it?

consumer.close() should probably do it.

>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609p4663648.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>


-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: actively close a durable subscription

Posted by "Marco.Crivellaro" <ma...@gmail.com>.
I've just realized calling DeleteDurableConsumer throws following error:

ex = {"javax.jms.JMSException : Durable consumer is in use"}


how can I stop the consumer before deleting it? 




--
View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609p4663648.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: actively close a durable subscription

Posted by "Marco.Crivellaro" <ma...@gmail.com>.
I guess in NMS this should correspond to
ISession.DeleteDurableConsumer("name")

I've tried this but the durable subscription is still shown on Offline
Durable Topic Subscriber list on Web Console.


this is the way the consumer is started:

_nmsConnection.Start()                
_nmsSession = _nmsConnection.CreateSession()
_nmsSubscriptonListener = New
Spring.Messaging.Nms.Listener.SimpleMessageListenerContainer()
_nmsNotificationConsumer =
_nmsSession.CreateDurableConsumer(_nmsNotificationTopic,
															"name",
															topicSelector.ToString(),
															False) 'TODO check this last flag
AddHandler _nmsNotificationConsumer.Listener, AddressOf OnNMSMessage




and this is how it is stopped (should be...):


_nmsSession.DeleteDurableConsumer("name")



--
View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609p4663638.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: actively close a durable subscription

Posted by Timothy Bish <ta...@gmail.com>.
On 02/18/2013 07:33 AM, Marco.Crivellaro wrote:
> A typical durable subscriber in my use case is started and stopped manually
> frequently (with different message selector) I would like to close the
> durable subscription when the consumer is stopped intentionally.
> I haven't found anything on how to end a durable subscription in a way
> activemq doesn't keep in memory a copy of the message for the subscriber;
> how can I achieve this?
> I can check for inactive subscribers like described here:
> http://activemq.apache.org/manage-durable-subscribers.html but I'd prefer to
> actively unsubscribe from the topic.
>
To remove your durable subscription use the 
Session#unsubscrobe(subscriptionName) method.

>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/actively-close-a-durable-subscription-tp4663609.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>


-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/