The Failover TransportThe Failover transport layers reconnect logic on top of any of the other transports. (We used to call this transport the Reliable transport in ActiveMQ 3). The Failover configuration syntax allows you to specify any number of composite uris. The Failover transport randomly chooses one of the composite URI and attempts to establish a connection to it. If it does not succeed or if it subsequently fails, a new connection is established to one of the other uris in the list. Configuration Syntaxfailover:(uri1,...,uriN)?transportOptions The failover transport uses random by default which lets you to load balance clients over a number of brokers. If you would rather connect to a primary first and only connect to a secondary backup broker if the primary is unavailable, turn of randomizing using something like failover:(tcp://primary:61616,tcp://secondary:61616)?randomize=false Transport Options
Example URIfailover:(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100 If the above gives errors try it this way (this way works in ActiveMQ 4.1.1 the one above does not) failover://(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100 NotesIf you use failover, and broker dies at some point, your sends will block. Using TransportListener |