[hornetq-commits] JBoss hornetq SVN: r10011 - in trunk/examples/jms: non-transaction-failover and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 8 02:57:53 EST 2010


Author: ataylor
Date: 2010-12-08 02:57:53 -0500 (Wed, 08 Dec 2010)
New Revision: 10011

Added:
   trunk/examples/jms/failover-manual-stop/
Modified:
   trunk/examples/jms/non-transaction-failover/build.xml
   trunk/examples/jms/non-transaction-failover/server0/hornetq-configuration.xml
   trunk/examples/jms/non-transaction-failover/server0/hornetq-jms.xml
   trunk/examples/jms/non-transaction-failover/server1/hornetq-configuration.xml
   trunk/examples/jms/non-transaction-failover/server1/hornetq-jms.xml
   trunk/examples/jms/non-transaction-failover/src/org/hornetq/jms/example/NonTransactionFailoverExample.java
Log:
fixed non transaction failover test

Modified: trunk/examples/jms/non-transaction-failover/build.xml
===================================================================
--- trunk/examples/jms/non-transaction-failover/build.xml	2010-12-08 06:53:58 UTC (rev 10010)
+++ trunk/examples/jms/non-transaction-failover/build.xml	2010-12-08 07:57:53 UTC (rev 10011)
@@ -34,7 +34,7 @@
    </target>
      
    <target name="delete-files" depends="clean">
-      <delete file="./server1/KILL_ME"/>           
+      <delete file="./server0/KILL_ME"/>           
    </target>
 
 </project>

Modified: trunk/examples/jms/non-transaction-failover/server0/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/non-transaction-failover/server0/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
+++ trunk/examples/jms/non-transaction-failover/server0/hornetq-configuration.xml	2010-12-08 07:57:53 UTC (rev 10011)
@@ -2,7 +2,13 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
 
-   <live-connector-ref connector-name="live-connector"/>
+   <clustered>true</clustered>
+
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
+   <shared-store>true</shared-store>
+    
    <!-- Connectors -->
 
    <connectors>
@@ -10,10 +16,6 @@
          <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
          <param key="port" value="5445"/>
       </connector>
-      <connector name="live-connector">
-         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
-         <param key="port" value="5446"/>
-      </connector>
    </connectors>      
 
    <!-- Acceptors -->
@@ -23,7 +25,31 @@
          <param key="port" value="5445"/>
       </acceptor>
    </acceptors>
-   
+
+    <broadcast-groups>
+		<broadcast-group name="bg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<broadcast-period>1000</broadcast-period>
+         <connector-ref>netty-connector</connector-ref>
+		</broadcast-group>
+	</broadcast-groups>
+
+	<discovery-groups>
+		<discovery-group name="dg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<refresh-timeout>60000</refresh-timeout>
+		</discovery-group>
+	</discovery-groups>
+
+	<cluster-connections>
+		<cluster-connection name="my-cluster">
+			<address>jms</address>
+         <connector-ref>netty-connector</connector-ref>
+			<discovery-group-ref discovery-group-name="dg-group1"/>
+		</cluster-connection>
+	</cluster-connections>
    <!-- Other config -->
 
    <security-settings>

Modified: trunk/examples/jms/non-transaction-failover/server0/hornetq-jms.xml
===================================================================
--- trunk/examples/jms/non-transaction-failover/server0/hornetq-jms.xml	2010-12-08 06:53:58 UTC (rev 10010)
+++ trunk/examples/jms/non-transaction-failover/server0/hornetq-jms.xml	2010-12-08 07:57:53 UTC (rev 10011)
@@ -10,6 +10,18 @@
       <entries>
          <entry name="ConnectionFactory"/>
       </entries>
+       
+       <ha>true</ha>
+      <!-- Pause 1 second between connect attempts -->
+      <retry-interval>1000</retry-interval>
+
+      <!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to
+      implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect
+      pause is the same length -->
+      <retry-interval-multiplier>1.0</retry-interval-multiplier>
+
+      <!-- Try reconnecting an unlimited number of times (-1 means "unlimited") -->
+      <reconnect-attempts>-1</reconnect-attempts>
    </connection-factory>
 
    <!--the queue used by the example-->

Modified: trunk/examples/jms/non-transaction-failover/server1/hornetq-configuration.xml
===================================================================
--- trunk/examples/jms/non-transaction-failover/server1/hornetq-configuration.xml	2010-12-08 06:53:58 UTC (rev 10010)
+++ trunk/examples/jms/non-transaction-failover/server1/hornetq-configuration.xml	2010-12-08 07:57:53 UTC (rev 10011)
@@ -1,6 +1,16 @@
 <configuration xmlns="urn:hornetq"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="urn:hornetq ../../../src/schema/hornetq-configuration.xsd">
+
+   <clustered>true</clustered>
+
+    <backup>true</backup>
+    
+   <!--we kill the server process so don't need this set to true-->
+   <failover-on-shutdown>false</failover-on-shutdown>
+
+   <shared-store>true</shared-store>
+    
    <!-- Connectors -->
 
    <connectors>
@@ -17,7 +27,37 @@
          <param key="port" value="5446"/>
       </acceptor>
    </acceptors>
-   
+
+    <broadcast-groups>
+		<broadcast-group name="bg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<broadcast-period>1000</broadcast-period>
+         <connector-ref>netty-connector</connector-ref>
+		</broadcast-group>
+	</broadcast-groups>
+
+	<discovery-groups>
+		<discovery-group name="dg-group1">
+			<group-address>231.7.7.7</group-address>
+			<group-port>9876</group-port>
+			<refresh-timeout>60000</refresh-timeout>
+		</discovery-group>
+	</discovery-groups>
+
+	<cluster-connections>
+		<cluster-connection name="my-cluster">
+			<address>jms</address>
+         <connector-ref>netty-connector</connector-ref>
+			<discovery-group-ref discovery-group-name="dg-group1"/>
+		</cluster-connection>
+	</cluster-connections>
+
+   <large-messages-directory>../server0/data/large-messages</large-messages-directory>
+   <bindings-directory>../server0/data/bindings</bindings-directory>
+   <journal-directory>../server0/data/journal</journal-directory>
+   <paging-directory>../server0/data/paging</paging-directory>
+    
    <!-- Other config -->
 
    <security-settings>

Modified: trunk/examples/jms/non-transaction-failover/server1/hornetq-jms.xml
===================================================================
--- trunk/examples/jms/non-transaction-failover/server1/hornetq-jms.xml	2010-12-08 06:53:58 UTC (rev 10010)
+++ trunk/examples/jms/non-transaction-failover/server1/hornetq-jms.xml	2010-12-08 07:57:53 UTC (rev 10011)
@@ -10,6 +10,18 @@
       <entries>
          <entry name="ConnectionFactory"/>
       </entries>
+
+       <ha>true</ha>
+      <!-- Pause 1 second between connect attempts -->
+      <retry-interval>1000</retry-interval>
+
+      <!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to
+      implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect
+      pause is the same length -->
+      <retry-interval-multiplier>1.0</retry-interval-multiplier>
+
+      <!-- Try reconnecting an unlimited number of times (-1 means "unlimited") -->
+      <reconnect-attempts>-1</reconnect-attempts>
    </connection-factory>
 
    <!--the queue used by the example-->

Modified: trunk/examples/jms/non-transaction-failover/src/org/hornetq/jms/example/NonTransactionFailoverExample.java
===================================================================
--- trunk/examples/jms/non-transaction-failover/src/org/hornetq/jms/example/NonTransactionFailoverExample.java	2010-12-08 06:53:58 UTC (rev 10010)
+++ trunk/examples/jms/non-transaction-failover/src/org/hornetq/jms/example/NonTransactionFailoverExample.java	2010-12-08 07:57:53 UTC (rev 10011)
@@ -49,7 +49,7 @@
       try
       {
          // Step 1. Get an initial context for looking up JNDI from the server #1
-         initialContext = getContext(1);
+         initialContext = getContext(0);
 
          // Step 2. Look up the JMS resources from JNDI
          Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
@@ -94,8 +94,8 @@
 
          // Step 10. Crash server #1, the live server, and wait a little while to make sure
          // it has really crashed
-         killServer(1);
-         Thread.sleep(5000);
+         Thread.sleep(2000);
+         killServer(0);
 
          // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
          // backup server has occured



More information about the hornetq-commits mailing list