You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ariekenb <aa...@lmco.com> on 2009/03/05 03:38:12 UTC

Are durable topic subscriptions destroyed?

If I create a durable topic subscription using the jms or activemq components
(for example
activemq:topic:myTopic?clientId=client1&durableSubscriptionName=subscription1),
does camel ever cause the durable subscription to be destroyed?  In other
words will camel ever cause session.unsubscribe to be called?  I'm working
in a situation where I'm implementing failover of a durable subscription on
different machines using camel and I want to be sure the durable
subscription does not get destroyed when the camel context is destroyed. 
Just out of curiosity, I'm also wondering how/if one can indicate he wants
the durable subscription to be destroyed when the camel context is
destroyed.

As an aside there is a small bug on this web page describing durable
subscriptions (http://camel.apache.org/jms.html).  The first paragraph under
"Notes" states "If you wish to use durable topic subscriptions, you need to
specify both clientId and durableSubscriberName."  durableSubscriberName
does not work.  The table below has the correct property:
durableSubscriptionName.
-- 
View this message in context: http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22344211.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Are durable topic subscriptions destroyed?

Posted by akuhtz <an...@siemens.com>.
I know that this is the case with ActiveMQ (you posted about it some time ago
in this forum) but we're using Oracle AQ (Streams replication) and their
samples show how they think it should work .... and in their case the
unsubscribe stops the delivery of messages.
 

James.Strachan wrote:
> 
> 2009/3/5 akuhtz <an...@siemens.com>:
>>
>> There is currently no code to unsubscribe a durable subscriber as Camel
>> uses
>> the XXMessageListenerContainer classes from the spring framework and
>> inside
>> the spring code there is no unsubscribe code. I solved this yesterday by
>> making a copy of the (in my case) SimpleMessageListenerContainer and
>> added
>> the unsubscribe code to the doShutdown() method (I couldn't just extend
>> from
>> SimpleMessageListenerContainer and overwrite doShutdown() because the
>> consumers are private and no protected access method exists, and between
>> close the consumers and close the session there is (unfortunately) no
>> callback where the unsubcribe could be executed.
>>
>> If you find another solution without copying the class please let me know
>> :-)
> 
> BTW whether the subscription is closed using an unsubscribe or if the
> process hosting the consumer just dies - its the same thing from a JMS
> provider's perspective.
> 
> i.e. closing a durable topic subscriber does not terminate the durable
> subscription. The whole point of a durable topic subscription is to
> keep going while the consumer is not running any more.
> 
> There's no JMS API to terminate a durable subscription - unfortunately
> thats JMS provider specific and usually achieved using MBeans or some
> provider specific console
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22411405.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Are durable topic subscriptions destroyed?

Posted by James Strachan <ja...@gmail.com>.
2009/3/5 akuhtz <an...@siemens.com>:
>
> There is currently no code to unsubscribe a durable subscriber as Camel uses
> the XXMessageListenerContainer classes from the spring framework and inside
> the spring code there is no unsubscribe code. I solved this yesterday by
> making a copy of the (in my case) SimpleMessageListenerContainer and added
> the unsubscribe code to the doShutdown() method (I couldn't just extend from
> SimpleMessageListenerContainer and overwrite doShutdown() because the
> consumers are private and no protected access method exists, and between
> close the consumers and close the session there is (unfortunately) no
> callback where the unsubcribe could be executed.
>
> If you find another solution without copying the class please let me know
> :-)

BTW whether the subscription is closed using an unsubscribe or if the
process hosting the consumer just dies - its the same thing from a JMS
provider's perspective.

i.e. closing a durable topic subscriber does not terminate the durable
subscription. The whole point of a durable topic subscription is to
keep going while the consumer is not running any more.

There's no JMS API to terminate a durable subscription - unfortunately
thats JMS provider specific and usually achieved using MBeans or some
provider specific console

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: Are durable topic subscriptions destroyed?

Posted by akuhtz <an...@siemens.com>.
Spring Issue created: http://jira.springframework.org/browse/SPR-5552


Claus Ibsen-2 wrote:
> 
> On Thu, Mar 5, 2009 at 12:33 PM, akuhtz <an...@siemens.com> wrote:
>>
>> There is currently no code to unsubscribe a durable subscriber as Camel
>> uses
>> the XXMessageListenerContainer classes from the spring framework and
>> inside
>> the spring code there is no unsubscribe code. I solved this yesterday by
>> making a copy of the (in my case) SimpleMessageListenerContainer and
>> added
>> the unsubscribe code to the doShutdown() method (I couldn't just extend
>> from
>> SimpleMessageListenerContainer and overwrite doShutdown() because the
>> consumers are private and no protected access method exists, and between
>> close the consumers and close the session there is (unfortunately) no
>> callback where the unsubcribe could be executed.
>>
>> If you find another solution without copying the class please let me know
>> :-)
> You could consider creating a ticket at Spring about this issue to
> allow easier subclassing of the SimpleMessageListenerContainer, or
> callbacks so we can do the unsubscribe there. Would be good to get in
> Spring 3.0.
> 
> 
>>
>>
>> Claus Ibsen-2 wrote:
>>>
>>> On Thu, Mar 5, 2009 at 3:38 AM, ariekenb <aa...@lmco.com>
>>> wrote:
>>>>
>>>> If I create a durable topic subscription using the jms or activemq
>>>> components
>>>> (for example
>>>> activemq:topic:myTopic?clientId=client1&durableSubscriptionName=subscription1),
>>>> does camel ever cause the durable subscription to be destroyed?  In
>>>> other
>>>> words will camel ever cause session.unsubscribe to be called?  I'm
>>>> working
>>>> in a situation where I'm implementing failover of a durable
>>>> subscription
>>>> on
>>>> different machines using camel and I want to be sure the durable
>>>> subscription does not get destroyed when the camel context is
>>>> destroyed.
>>>> Just out of curiosity, I'm also wondering how/if one can indicate he
>>>> wants
>>>> the durable subscription to be destroyed when the camel context is
>>>> destroyed.
>>> Not to my knowledge. But I would advice you to double check the source
>>> code of camel-jms
>>> to see if there is any code that would call unsubscribe. Usually such
>>> code would be in doStop or stop methods.
>>>
>>> James Strachan who wrote the camel-jms component would be in a better
>>> position to clarify this.
>>>
>>> With your findings we should update the wiki, so please report back.
>>>
>>>
>>>>
>>>> As an aside there is a small bug on this web page describing durable
>>>> subscriptions (http://camel.apache.org/jms.html).  The first paragraph
>>>> under
>>>> "Notes" states "If you wish to use durable topic subscriptions, you
>>>> need
>>>> to
>>>> specify both clientId and durableSubscriberName."
>>>>  durableSubscriberName
>>>> does not work.  The table below has the correct property:
>>>> durableSubscriptionName.
>>> Thanks for spotting this. Fixed the typo.
>>>
>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22344211.html
>>>> Sent from the Camel - Users (activemq) mailing list archive at
>>>> Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Claus Ibsen
>>> Apache Camel Committer
>>>
>>> Open Source Integration: http://fusesource.com
>>> Blog: http://davsclaus.blogspot.com/
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22349650.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22409437.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Are durable topic subscriptions destroyed?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 12:33 PM, akuhtz <an...@siemens.com> wrote:
>
> There is currently no code to unsubscribe a durable subscriber as Camel uses
> the XXMessageListenerContainer classes from the spring framework and inside
> the spring code there is no unsubscribe code. I solved this yesterday by
> making a copy of the (in my case) SimpleMessageListenerContainer and added
> the unsubscribe code to the doShutdown() method (I couldn't just extend from
> SimpleMessageListenerContainer and overwrite doShutdown() because the
> consumers are private and no protected access method exists, and between
> close the consumers and close the session there is (unfortunately) no
> callback where the unsubcribe could be executed.
>
> If you find another solution without copying the class please let me know
> :-)
You could consider creating a ticket at Spring about this issue to
allow easier subclassing of the SimpleMessageListenerContainer, or
callbacks so we can do the unsubscribe there. Would be good to get in
Spring 3.0.


>
>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Mar 5, 2009 at 3:38 AM, ariekenb <aa...@lmco.com>
>> wrote:
>>>
>>> If I create a durable topic subscription using the jms or activemq
>>> components
>>> (for example
>>> activemq:topic:myTopic?clientId=client1&durableSubscriptionName=subscription1),
>>> does camel ever cause the durable subscription to be destroyed?  In other
>>> words will camel ever cause session.unsubscribe to be called?  I'm
>>> working
>>> in a situation where I'm implementing failover of a durable subscription
>>> on
>>> different machines using camel and I want to be sure the durable
>>> subscription does not get destroyed when the camel context is destroyed.
>>> Just out of curiosity, I'm also wondering how/if one can indicate he
>>> wants
>>> the durable subscription to be destroyed when the camel context is
>>> destroyed.
>> Not to my knowledge. But I would advice you to double check the source
>> code of camel-jms
>> to see if there is any code that would call unsubscribe. Usually such
>> code would be in doStop or stop methods.
>>
>> James Strachan who wrote the camel-jms component would be in a better
>> position to clarify this.
>>
>> With your findings we should update the wiki, so please report back.
>>
>>
>>>
>>> As an aside there is a small bug on this web page describing durable
>>> subscriptions (http://camel.apache.org/jms.html).  The first paragraph
>>> under
>>> "Notes" states "If you wish to use durable topic subscriptions, you need
>>> to
>>> specify both clientId and durableSubscriberName."  durableSubscriberName
>>> does not work.  The table below has the correct property:
>>> durableSubscriptionName.
>> Thanks for spotting this. Fixed the typo.
>>
>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22344211.html
>>> Sent from the Camel - Users (activemq) mailing list archive at
>>> Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22349650.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/

Re: Are durable topic subscriptions destroyed?

Posted by akuhtz <an...@siemens.com>.
There is currently no code to unsubscribe a durable subscriber as Camel uses
the XXMessageListenerContainer classes from the spring framework and inside
the spring code there is no unsubscribe code. I solved this yesterday by
making a copy of the (in my case) SimpleMessageListenerContainer and added
the unsubscribe code to the doShutdown() method (I couldn't just extend from
SimpleMessageListenerContainer and overwrite doShutdown() because the
consumers are private and no protected access method exists, and between
close the consumers and close the session there is (unfortunately) no
callback where the unsubcribe could be executed.

If you find another solution without copying the class please let me know
:-)


Claus Ibsen-2 wrote:
> 
> On Thu, Mar 5, 2009 at 3:38 AM, ariekenb <aa...@lmco.com>
> wrote:
>>
>> If I create a durable topic subscription using the jms or activemq
>> components
>> (for example
>> activemq:topic:myTopic?clientId=client1&durableSubscriptionName=subscription1),
>> does camel ever cause the durable subscription to be destroyed?  In other
>> words will camel ever cause session.unsubscribe to be called?  I'm
>> working
>> in a situation where I'm implementing failover of a durable subscription
>> on
>> different machines using camel and I want to be sure the durable
>> subscription does not get destroyed when the camel context is destroyed.
>> Just out of curiosity, I'm also wondering how/if one can indicate he
>> wants
>> the durable subscription to be destroyed when the camel context is
>> destroyed.
> Not to my knowledge. But I would advice you to double check the source
> code of camel-jms
> to see if there is any code that would call unsubscribe. Usually such
> code would be in doStop or stop methods.
> 
> James Strachan who wrote the camel-jms component would be in a better
> position to clarify this.
> 
> With your findings we should update the wiki, so please report back.
> 
> 
>>
>> As an aside there is a small bug on this web page describing durable
>> subscriptions (http://camel.apache.org/jms.html).  The first paragraph
>> under
>> "Notes" states "If you wish to use durable topic subscriptions, you need
>> to
>> specify both clientId and durableSubscriberName."  durableSubscriberName
>> does not work.  The table below has the correct property:
>> durableSubscriptionName.
> Thanks for spotting this. Fixed the typo.
> 
> 
>> --
>> View this message in context:
>> http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22344211.html
>> Sent from the Camel - Users (activemq) mailing list archive at
>> Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Claus Ibsen
> Apache Camel Committer
> 
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22349650.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Re: Are durable topic subscriptions destroyed?

Posted by Claus Ibsen <cl...@gmail.com>.
On Thu, Mar 5, 2009 at 3:38 AM, ariekenb <aa...@lmco.com> wrote:
>
> If I create a durable topic subscription using the jms or activemq components
> (for example
> activemq:topic:myTopic?clientId=client1&durableSubscriptionName=subscription1),
> does camel ever cause the durable subscription to be destroyed?  In other
> words will camel ever cause session.unsubscribe to be called?  I'm working
> in a situation where I'm implementing failover of a durable subscription on
> different machines using camel and I want to be sure the durable
> subscription does not get destroyed when the camel context is destroyed.
> Just out of curiosity, I'm also wondering how/if one can indicate he wants
> the durable subscription to be destroyed when the camel context is
> destroyed.
Not to my knowledge. But I would advice you to double check the source
code of camel-jms
to see if there is any code that would call unsubscribe. Usually such
code would be in doStop or stop methods.

James Strachan who wrote the camel-jms component would be in a better
position to clarify this.

With your findings we should update the wiki, so please report back.


>
> As an aside there is a small bug on this web page describing durable
> subscriptions (http://camel.apache.org/jms.html).  The first paragraph under
> "Notes" states "If you wish to use durable topic subscriptions, you need to
> specify both clientId and durableSubscriberName."  durableSubscriberName
> does not work.  The table below has the correct property:
> durableSubscriptionName.
Thanks for spotting this. Fixed the typo.


> --
> View this message in context: http://www.nabble.com/Are-durable-topic-subscriptions-destroyed--tp22344211p22344211.html
> Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.
>
>



-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/