Sep 9th, 2008, 07:05 PM
How to unsubscribe() a durable subscriber from DefaultMessageListenerContainer?
I set up a DefaultMessageListenerContainer for a durable subscriber. After running my test program, the container bean should be destroyed and all the resources should be released. However, from ActiveMQ admin console, the number of consumer is still '1'. It seems that the durable subscriber is closed but not unsubscribed. Is there any way from DefaultMessageListenerContainer to permanently unsubscribe it?
<bean id="jmsDurableTopicContainer" class="org.springframework.jms.listener.DefaultMes sageListenerContainer">
<property name="connectionFactory" ref="jmsFactory"/>
<property name="destination" ref="durableTopic"/>
<property name="subscriptionDurable" value="true"/>
<property name="durableSubscriptionName" value="TestDurableSub"/>
<property name="clientId" value="TestConnection"/>
Sep 11th, 2008, 03:50 AM
If you want your subscription to go away when your JVM closes - maybe you don't want a durable subscription?
Note that a durable JMS subscription is only used when you explicitly dont want your subscription to go away when the JVM goes away.
If you only want to receive messages when your JVM is active, use a normal topic subscription.
Note that durability of subscription != durability of messages.
e.g. a non durable topic subscription can subscribe to both durable and non-durable messages
Sep 11th, 2008, 11:35 AM
OK. I understand that durable subscriber will not go away when JVM closes. It's exactly what my use case for durable subscriber to receive messages during its downtime. However, how to permanently unsubscribe the durable subscriber? I don't want the durable subscriber automatically be unsubscribed when the JVM closes. But I could not find an explicit unsubscribe() from DefaultMessageListenerContainer.
Thanks a lot for the input.
May 31st, 2011, 04:08 PM
Have you found solution for this? How to unsubscribe from a durable subscription when it is created using DefaultMessageListenerContainer bean?