activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniele Dellafiore <>
Subject Re: Reconnect a closed durable subscriber
Date Thu, 01 Jul 2010 09:38:44 GMT
I tried this way with no success.
I create a new subscriber s2b after having called s2a.close(), while
s1 is always active.

s2b = session.createDurableSubscriber(topic, consumerName);

where session is the same instance I used the first time, so is topic
and consumerName

after this line, i push new messages on the queue with, from the same producer.
Now, both s1 and s2b receives this new set of messages, and it is ok.
What is not right is that I expect that when I reconnect s2b, it
receives also the messages delivered while he was offline. This last
thing does not happen.

On Wed, Jun 30, 2010 at 2:33 PM, Stan Lewis <> wrote:
> You have to connect to the broker using the same client ID and then
> create a subscription using the same name as you used previously, that
> will get you connected to the existing subscription.
> On Wed, Jun 30, 2010 at 8:24 AM, Daniele Dellafiore <> wrote:
>> Hi everyone. I just started using ActiveMQ and this is my first
>> message to the list.
>> I have searched for answer for my question on the archive without success.
>> Quick version: I simply can't find a way to reconnect a durable
>> subscriber after calling MessageConsumer.close() method to disconnect.
>> Long version:
>> I am trying to make a durable subscriber work like in this example:
>> that is: a disconnected durable subscriber receive all messages
>> dispatched when he was offline at the moment he reconnects.
>> So I create a producer and a durable subscriber
>> I send message M1 and is received. Then I call
>> consumer.close()
>> and send M2 which is not received, correctly.
>> Then I want to reconnect consumer, send M3 and see that consumer
>> receives M2 and M3.
>> But I can't find a method or a way to reconnect the subscriber.
>> What is the right way?
>> Thanks for any help.
>> --
>> Daniele Dellafiore

Daniele Dellafiore

View raw message