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 <ilde...@gmail.com> 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: > http://activemq.apache.org/how-do-durable-queues-and-topics-work.html > > 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 > http://danieledellafiore.net >