activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From DCMH <>
Subject Getting Durable Messages After Failover
Date Tue, 23 Jun 2009 09:20:26 GMT

This is the first time I'm using ActiveMQ, the version I'm using is 5.2,
below is my configuration:

I have 2 ActiveMQ brokers setup in a cluster.

Both brokers have the following conf:
  <networkConnector name="MQ" uri="static://(tcp://{IP of broker
1}:61616,tcp://{IP of broker 2}:61616)"/>
  <transportConnector name="openwire" uri="tcp://localhost:61616"/>
  <transportConnector name="ssl" uri="ssl://localhost:61617"/>
  <transportConnector name="stomp" uri="stomp://localhost:61613"/>
  <transportConnector name="xmpp" uri="xmpp://localhost:61222"/>

I have a client use the failover protocol to connect to the broker cluster :
failover://(tcp://{IP of broker 1}:61616,tcp://{IP of broker 2}:61616)

The client intends to consume the durable messages from a topic:

There is a message producer constantly producing durable messages to a
topic: DurableTopic.

When the client starts, it connects to broker 1 and subscribes to the
DurableTopic at broker 1 and consumes the messages produced by the message
producer. At some time, the client quits abnormally (without unsubscribing
to the DurableTopic at broker 1) while the message producer keeps publishing

I suppose that after the client reconnects to the broker cluster (using the
same failover protocol) will be able to consume the durable messages
generated by the producer since its abnormal exit.

However, I found that there are 2 possible cases:
(i) the client reconnects to broker 1
(ii) the client reconnects to broker 2

In case (i), the outcome is what I expected, the client is able to consume
the messages. However, In case (ii), the client is not able to consume those
messages after reconnecting to another broker.

It seems to me that when the client connects to another broker, it is not
able to resume the previous session even I use the same name to create the
durable subscriber.

I have to try to reconnect the client until it reconnects to broker 1 in
order to consume the durable messages.

Is there anyway that I can make my client able to consume the durable
messages after reconnection (no matter to broker 1 or broker 2)?
Or I have missed anything in the broker configuration?

Much appreciated if anyone can give me some ideas.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message