Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 85775 invoked from network); 1 Apr 2011 10:28:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Apr 2011 10:28:47 -0000 Received: (qmail 15104 invoked by uid 500); 1 Apr 2011 10:28:47 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 15058 invoked by uid 500); 1 Apr 2011 10:28:47 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 15050 invoked by uid 99); 1 Apr 2011 10:28:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Apr 2011 10:28:47 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Apr 2011 10:28:44 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 335688D547 for ; Fri, 1 Apr 2011 10:28:06 +0000 (UTC) Date: Fri, 1 Apr 2011 10:28:06 +0000 (UTC) From: "andy boot (JIRA)" To: dev@activemq.apache.org Message-ID: <548646362.27323.1301653686207.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1705410597.24614.1301585766721.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (AMQ-3256) For a Master Slave failover broker setup. The system does not reconnect to the broker if the brokers are restarted MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AMQ-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014506#comment-13014506 ] andy boot commented on AMQ-3256: -------------------------------- I realise this is a dirty hack and I haven't thought thru the implications but opening class FailoverTransport and commenting out line 1044 " this.uris.remove(uri);" in method "updateURIs()" appears to make it work. > For a Master Slave failover broker setup. The system does not reconnect to the broker if the brokers are restarted > ------------------------------------------------------------------------------------------------------------------ > > Key: AMQ-3256 > URL: https://issues.apache.org/jira/browse/AMQ-3256 > Project: ActiveMQ > Issue Type: Bug > Components: Broker > Affects Versions: 5.4.2 > Environment: Windows XP > Reporter: andy boot > Labels: failover > > Start a Master & Slave broker. > Connect to them with failover=true and randomize=false > Message Sending - ok. > Kill the Master broker. > Message Sending - ok. > Kill the Slave broker. > Message Sending - paused (both brokers are down) > Restart both brokers. > Message Sending - fail. > The above WORKS in ActiveMQ 5.3.1 but fails in 5.4.2 > I wonder if this is related to: https://issues.apache.org/jira/browse/AMQ-3213 > Steps to reproduce the problem: > * Run Broker, BrokerSlave, Client, Server, > * Note messages being sent from Server to Client > * Kill Broker > * Note messages being sent from Server to Client > * Kill BrokerSlave > * Restart Broker & BrokerSlave, > * Messages no longer being sent. > {code:title=Broker.java|borderStyle=solid} > public class Broker { > public static void main(String[] args) throws Exception { > BrokerService broker; > broker = BrokerFactory.createBroker("xbean:master.xml"); > broker.start(); > while(true) { > Thread.sleep(10*1000); > } > } > } > {code} > {code:title=BrokerSlave.java|borderStyle=solid} > public class BrokerSlave { > public static void main(String[] args) throws Exception { > BrokerService broker; > broker = BrokerFactory.createBroker("xbean:slave.xml"); > broker.start(); > while(true) { > Thread.sleep(10*1000); > } > } > } > {code} > {code:title=Client.java|borderStyle=solid} > public class Client { > static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false"; > static String user = null; > static String password = null; > public static void main(String[] args) throws JMSException, InterruptedException { > ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url); > final Connection connection = connectionFactory.createConnection(); > final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); > final Queue orderQueue = session.createQueue("VendorOrderQueue"); > final MessageConsumer consumer = session.createConsumer(orderQueue); > consumer.setMessageListener(new MsgL() ); > session.run(); > connection.start(); > while(true) { > Thread.sleep(5000); > } > } > private static class MsgL implements MessageListener { > public void onMessage(final Message message) { > System.out.println("Got message: "+message); > } > } > } > {code} > {code:title=Server.java|borderStyle=solid} > public class Server { > static String url = "failover://(tcp://localhost:61616,tcp://localhost:61617)?randomize=false"; > static String user = null; > static String password = null; > public static void main(String[] args) throws JMSException, InterruptedException { > ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url); > final Connection connection = connectionFactory.createConnection(); > final Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); > final Queue orderQueue = session.createQueue("VendorOrderQueue"); > final MessageProducer producer = session.createProducer(orderQueue); > session.run(); > connection.start(); > for (int i = 0; i < 100; i++) { > MapMessage message = session.createMapMessage(); > message.setString("Item", "hello "+i); > System.out.println("Sending: "+message); > producer.send(message); > System.out.println("Wait for 5s"); > Thread.sleep(5000); > } > } > } > {code} > {code:title=master.xml|borderStyle=solid} > xmlns="http://www.springframework.org/schema/beans" > xmlns:amq="http://activemq.apache.org/schema/core" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd > http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> > > persistent="false" > waitForSlave="true" > useJmx="true"> > > > > > > {code} > {code:title=slave.xml|borderStyle=solid} > xmlns="http://www.springframework.org/schema/beans" > xmlns:amq="http://activemq.apache.org/schema/core" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd > http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> > > persistent="false" > useJmx="false" > shutdownOnMasterFailure="false"> > > > > > > > > > {code} -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira