What's the consumer's logging output? When you shut down the master on hostA, the consumer will loose its connection to the broker and should try to reconnect. It will try both of the tcp urls in your list until it reconnects.
Also, can you confirm that your slave broker starts up just fine on the port number that you specified in your failover url of the consumer? Regards, Torsten Mielke tors...@fusesource.com tmie...@blogspot.com On Jun 28, 2012, at 1:59 PM, bizcenter wrote: > *Deploy the brokers with master/slave, when master stops, consumer can not > reconnect to slave.* > > code example: > /String brokerUrl = "failover:(tcp://hostA, tcp://hostB)"; > try { > connection = factory.createConnection(); > // if a durable topic subscription, and client id must be unique > if (durable && null != clientId && clientId.length() > 0) { > connection.setClientID(clientId); > } > connection.setExceptionListener(this); > connection.start(); > > session = connection.createSession(transacted, ackMode); > if (isTopic) { > destination = session.createTopic(subject); > } else { > destination = session.createQueue(subject); > } > > if (isTopic && durable) { > if (null != this.filter) { > consumer = session.createDurableSubscriber((Topic) > destination, consumerName, this.filter, false); > } else { > consumer = session.createDurableSubscriber((Topic) > destination, consumerName); > } > } else { > if (null != this.filter) { > consumer = session.createConsumer(destination, > this.filter); > } else { > consumer = session.createConsumer(destination); > } > } > > if (this.receiveTimeout == 0) { > consumer.setMessageListener(this); > } else { > consumeMessagesAndClose(connection, session, consumer, > receiveTimeout); > } > // no execution about closing connection, session, consumer/ > ------------------------------------------------------------------------------------------ > > anyone can give me a favor? thanks. (my english is poor...) > > > > -- > View this message in context: > http://activemq.2283324.n4.nabble.com/master-slave-consumer-can-not-failover-tp4653639.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com.