Results 1 to 4 of 4

Thread: How to unsubscribe() a durable subscriber from DefaultMessageListenerContainer?

  1. #1
    Join Date
    Nov 2007
    Posts
    12

    Default 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"/>
    </bean>

    Thank you.

  2. #2
    Join Date
    Aug 2004
    Location
    London
    Posts
    164

    Default

    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
    James Strachan
    ------------------
    Open Source Integration
    Iona

  3. #3
    Join Date
    Nov 2007
    Posts
    12

    Default

    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.

  4. #4
    Join Date
    Aug 2007
    Location
    Boston
    Posts
    20

    Default

    Hi janylj,

    Have you found solution for this? How to unsubscribe from a durable subscription when it is created using DefaultMessageListenerContainer bean?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •