activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amit Bohra (JIRA)" <j...@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
Date Fri, 01 Apr 2011 07:00:06 GMT

    [ https://issues.apache.org/jira/browse/AMQ-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014442#comment-13014442
] 

Amit Bohra commented on AMQ-3256:
---------------------------------

I also faced the similar problem. Here are the steps for the same:
1. Failover setup using JDBC MySQL
2. Start master and slave
3. Send messages - (success)
4. Stop master
5. Send messages - (success, as slave has picked them up)
6. Restart master and stop slave
7. Send messages - (hung, clients waiting for connection)

> 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}
> <beans
>     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">
>   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>   <broker xmlns="http://activemq.apache.org/schema/core"
>           persistent="false"
>           waitForSlave="true"
>           useJmx="true">
>       <transportConnectors>
>         <transportConnector uri="tcp://localhost:61616"/>
>       </transportConnectors>
>   </broker>
> </beans>
> {code}
> {code:title=slave.xml|borderStyle=solid}
> <beans
>     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">
>   <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>   <broker xmlns="http://activemq.apache.org/schema/core"
>         persistent="false"
>         useJmx="false"
>         shutdownOnMasterFailure="false">
>     <services>
>       <masterConnector remoteURI="tcp://localhost:61616"/>
>     </services>
>     <transportConnectors>
> 	    <transportConnector uri="tcp://localhost:61617"/>
>     </transportConnectors>
> </broker>
> </beans>
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message