activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <>
Subject Re: Clients can get stuck in a reconnect loop with master-slave brokers
Date Tue, 22 Mar 2011 15:15:39 GMT
The test needs some mods to ensure that the slave broker listen port
is only started when the broker becomes the baster.

In code, the addition of the transportConnector needs to be:

        // lazy create transport connector on start completion
        TransportConnector connector = new TransportConnector();
        connector.setUri(new URI("tcp://localhost:" + listenPort));

In cases where failover needs to abort you can configure the
maxReconnectAttempts to be > 0 and it will fail with an exception
after X attempts.

On 22 March 2011 14:31, rasmusback <> wrote:
> Hi,
> I'm using the shared file system, master slave setup with two brokers on
> separate servers. My clients are configured to use the failover transport
> with a URL like this:
> failover://(tcp://broker1:61616,tcp://broker2:61616)?randomize=false. I've
> noticed that the order of the brokers in the failover URL seems to be
> significant. If I start broker2 before broker1, so that broker2 becomes the
> master and broker1 the slave, clients will get stuck in a reconnect loop
> where they keep trying to connect to broker1.
> Attached is a junit test case which exhibits the same behavior as my setup.
> If the startup order of the brokers is different from their order in the
> failover URL, the test will timeout. When the order is the same, the test
> will pass.
> The slave broker opens a socket, so a tcp connection is possible to it even
> though the broker functionality isn't enabled. This might be what is
> confusing the failover transport.
> I'm not quite sure if my broker configuration is incorrect or if this is a
> bug (or feature) in a master slave setup, so any help is much appreciated.
> I'm using ActiveMQ 5.4.2 and spring-jms 2.5.5.
>   Rasmus
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at


View raw message