Author: ataylor
Date: 2011-03-07 07:38:06 -0500 (Mon, 07 Mar 2011)
New Revision: 10295
Modified:
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-configuration.xml
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-jms.xml
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-configuration.xml
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-jms.xml
branches/Branch_2_2_EAP/examples/jms/transaction-failover/src/org/hornetq/jms/example/TransactionFailoverExample.java
Log:
fixed transaction failover example
Modified:
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-configuration.xml
===================================================================
---
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-configuration.xml 2011-03-07
12:06:25 UTC (rev 10294)
+++
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-configuration.xml 2011-03-07
12:38:06 UTC (rev 10295)
@@ -1,8 +1,14 @@
<configuration xmlns="urn:hornetq"
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:
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-jms.xml
===================================================================
---
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-jms.xml 2011-03-07
12:06:25 UTC (rev 10294)
+++
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server0/hornetq-jms.xml 2011-03-07
12:38:06 UTC (rev 10295)
@@ -9,6 +9,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:
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-configuration.xml
===================================================================
---
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-configuration.xml 2011-03-07
12:06:25 UTC (rev 10294)
+++
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-configuration.xml 2011-03-07
12:38:06 UTC (rev 10295)
@@ -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:
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-jms.xml
===================================================================
---
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-jms.xml 2011-03-07
12:06:25 UTC (rev 10294)
+++
branches/Branch_2_2_EAP/examples/jms/transaction-failover/server1/hornetq-jms.xml 2011-03-07
12:38:06 UTC (rev 10295)
@@ -9,6 +9,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:
branches/Branch_2_2_EAP/examples/jms/transaction-failover/src/org/hornetq/jms/example/TransactionFailoverExample.java
===================================================================
---
branches/Branch_2_2_EAP/examples/jms/transaction-failover/src/org/hornetq/jms/example/TransactionFailoverExample.java 2011-03-07
12:06:25 UTC (rev 10294)
+++
branches/Branch_2_2_EAP/examples/jms/transaction-failover/src/org/hornetq/jms/example/TransactionFailoverExample.java 2011-03-07
12:38:06 UTC (rev 10295)
@@ -50,7 +50,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");