Skip to content
Browse files

Merge pull request #354 from andytaylor/master

added replication example
  • Loading branch information...
2 parents 3ecab6e + cc69e20 commit 1af3b0a28258f59874530519c83bbb01145ec395 @clebertsuconic clebertsuconic committed Jul 13, 2012
View
158 examples/jms/replicated-failback/pom.xml
@@ -0,0 +1,158 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.hornetq.examples.jms</groupId>
+ <artifactId>jms-examples</artifactId>
+ <version>2.3.0.Alpha</version>
+ </parent>
+
+ <artifactId>hornetq-jms-replicated-failback-example</artifactId>
+ <packaging>jar</packaging>
+ <name>HornetQ JMS Replicated Failback Example</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.hornetq.examples.jms</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-maven-plugin</artifactId>
+ <version>1.0.0</version>
+ <executions>
+ <execution>
+ <id>start0</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <hornetqConfigurationDir>${basedir}/target/classes/hornetq/server0</hornetqConfigurationDir>
+ <systemProperties>
+ <property>
+ <name>build.directory</name>
+ <value>${basedir}/target/</value>
+ </property>
+ <property>
+ <name>udp-address</name>
+ <value>${udp-address}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>start1</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ <configuration>
+ <jndiPort>1199</jndiPort>
+ <jndiRmiPort>1198</jndiRmiPort>
+ <hornetqConfigurationDir>${basedir}/target/classes/hornetq/server1</hornetqConfigurationDir>
+ <fork>true</fork>
+ <systemProperties>
+ <property>
+ <name>build.directory</name>
+ <value>${basedir}/target/</value>
+ </property>
+ <property>
+ <name>udp-address</name>
+ <value>${udp-address}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>runClient</id>
+ <goals>
+ <goal>runClient</goal>
+ </goals>
+ <configuration>
+ <clientClass>org.hornetq.jms.example.ReplicatedFailbackExample</clientClass>
+ <args>
+ <param>jnp://localhost:1099</param>
+ <param>jnp://localhost:1199</param>
+ </args>
+ <systemProperties>
+ <property>
+ <name>exampleConfigDir</name>
+ <value>${basedir}/target/classes/hornetq</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop0</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ <configuration>
+ <hornetqConfigurationDir>${basedir}/target/classes/hornetq/server0</hornetqConfigurationDir>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop1</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ <configuration>
+ <hornetqConfigurationDir>${basedir}/target/classes/hornetq/server1</hornetqConfigurationDir>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.hornetq.examples.jms</groupId>
+ <artifactId>hornetq-jms-replicated-failback-example</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hornetq</groupId>
+ <artifactId>hornetq-jms</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty</artifactId>
+ <version>3.4.5.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-jms-api</artifactId>
+ <version>1.1.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnpserver</artifactId>
+ <version>5.0.3.GA</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <waitOnStart>false</waitOnStart>
+ <systemProperties>
+ <property>
+ <name>build.directory</name>
+ <value>${basedir}/target/</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
View
153 examples/jms/replicated-failback/readme.html
@@ -0,0 +1,153 @@
+<html>
+ <head>
+ <title>HornetQ JMS Multiple Failover using Replication Example</title>
+ <link rel="stylesheet" type="text/css" href="../common/common.css" />
+ <link rel="stylesheet" type="text/css" href="../common/prettify.css" />
+ <script type="text/javascript" src="../common/prettify.js"></script>
+ </head>
+ <body onload="prettyPrint()">
+ <h1>JMS Multiple Failover using Replication Example</h1>
+
+ <b>Note that failback example is not working in 2.3.0.Alpha but will be fully functional in the next release.</b>
+
+ <p>This example demonstrates three servers coupled as a live-backup-backup group for high availability (HA) using replication, and a client
+ connection failing over from live to backup when the live server is crashed and then to the second backup once the new live fails.</p>
+
+ <p>For more information on HornetQ failover and HA, and clustering in general, please see the clustering
+ section of the user manual.</p>
+
+ <h2>Example step-by-step</h2>
+ <p><i>To run the example, simply type <code>mvn verify</code> from this directory</i></p>
+ <p>In this example, the live server is server 1, and the backup server is server 0</p>
+ <p>The connection will initially be created to server1, server 1 will crash, and the client will carry on
+ seamlessly on server 0, the backup server.</p>
+
+ <ol>
+ <li>Get an initial context for looking up JNDI from server #0.</li>
+ <pre class="prettyprint">
+ initialContext = getContext(0);
+ </pre>
+
+ <li>Look up the JMS resources from JNDI on server #0.</li>
+ <pre class="prettyprint">
+ Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
+ ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
+ </pre>
+
+ <li>Create a JMS Connection</li>
+ <pre class="prettyprint">
+ connection = connectionFactory.createConnection();
+ </pre>
+
+ <li>Create a client acknowledged Session</li>
+ <pre class="prettyprint">
+ Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+ </pre>
+
+ <li>Start the connection to ensure delivery occurs</li>
+ <pre class="prettyprint">
+ connection.start();
+ </pre>
+
+ <li>Create a JMS MessageProducer</li>
+ <pre class="prettyprint">
+ MessageProducer producer = session.createProducer(queue);
+ </pre>
+
+ <li>Create a JMS MessageConsumer</li>
+ <pre class="prettyprint">
+ MessageConsumer consumer = session.createConsumer(queue);
+ </pre>
+
+ <li>Send some messages to server #0, the live server</li>
+ <pre class="prettyprint">
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage message = session.createTextMessage("This is text message " + i);
+ producer.send(message);
+ System.out.println("Sent message: " + message.getText());
+ }
+ </pre>
+
+ <li>Receive and acknowledge a third of the sent messages</li>
+ <pre class="prettyprint">
+ TextMessage message0 = null;
+ for (int i = 0; i < numMessages / 3; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.println("Got message: " + message0.getText());
+ }
+ message0.acknowledge();
+ </pre>
+
+ <p>When server #0 crashes, the client automatically detects the failure and automatically
+ fails over from server #0 to server #1 (in your real program you wouldn't need to sleep).
+ </p>
+
+ <li>Acknowledging the 2nd third of the sent messages will fail as failover to the backup server has occurred</li>
+ <pre class="prettyprint">
+ try
+ {
+ message0.acknowledge();
+ }
+ catch (JMSException e)
+ {
+ System.err.println("Got exception while acknowledging message: " + e.getMessage());
+ }
+ </pre>
+
+ <li>Consume again the 2nd third of the messages again. Note that they are not considered as redelivered.</li>
+ <pre class="prettyprint">
+ for (int i = numMessages / 3; i < (numMessages / 3) * 2; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
+ }
+ message0.acknowledge();
+ </pre>
+
+ <p>now we Kill server #1 and wait for the server #2 to take over the responsibilities.</p>
+
+ <li>Acknowledging the 3rd third of the sent messages will fail as failover to the backup server has occurred</li>
+ <pre class="prettyprint">
+ try
+ {
+ message0.acknowledge();
+ }
+ catch (JMSException e)
+ {
+ System.err.println("Got exception while acknowledging message: " + e.getMessage());
+ }
+ </pre>
+
+
+ <li>Consume again the 3rd third of the messages again. Note that they are not considered as redelivered</li>
+ <pre class="prettyprint">
+ for (int i = (numMessages / 3) * 2; i < numMessages; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
+ }
+ message0.acknowledge();
+ </pre>
+
+ <li>And finally, <strong>always</strong> remember to close your resources after use, in a <code>finally</code> block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects</li>
+
+ <pre class="prettyprint">
+ finally
+ {
+ if (connection != null)
+ {
+ connection.close();
+ }
+
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ }
+ </pre>
+
+ </ol>
+ </body>
+</html>
View
160 .../replicated-failback/src/main/java/org/hornetq/jms/example/ReplicatedFailbackExample.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.jms.example;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import javax.jms.TextMessage;
+import javax.naming.InitialContext;
+
+import org.hornetq.common.example.HornetQExample;
+
+/**
+ * @author <a href="mailto:andy.taylor@jboss.com">Andy Taylor</a>
+ * Date: Nov 4, 2010
+ * Time: 10:51:45 AM
+ */
+public class ReplicatedFailbackExample extends HornetQExample
+{
+ public static void main(final String[] args)
+ {
+ new ReplicatedFailbackExample().run(args);
+ }
+
+ @Override
+ public boolean runExample() throws Exception
+ {
+ final int numMessages = 30;
+
+ Connection connection = null;
+
+ InitialContext initialContext = null;
+
+ try
+ {
+ // Step 1. Get an initial context for looking up JNDI from the server #1
+ initialContext = getContext(0);
+
+ // Step 2. Look up the JMS resources from JNDI
+ Queue queue = (Queue)initialContext.lookup("/queue/exampleQueue");
+ ConnectionFactory connectionFactory = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
+
+ // Step 3. Create a JMS Connection
+ connection = connectionFactory.createConnection();
+
+ // Step 4. Create a *non-transacted* JMS Session with client acknowledgement
+ Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
+
+ // Step 5. Start the connection to ensure delivery occurs
+ connection.start();
+
+ // Step 6. Create a JMS MessageProducer and a MessageConsumer
+ MessageProducer producer = session.createProducer(queue);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ // Step 7. Send some messages to server #1, the live server
+ for (int i = 0; i < numMessages; i++)
+ {
+ TextMessage message = session.createTextMessage("This is text message " + i);
+ producer.send(message);
+ System.out.println("Sent message: " + message.getText());
+ }
+
+ // Step 8. Receive and acknowledge a third of the sent messages
+ TextMessage message0 = null;
+ for (int i = 0; i < numMessages / 3; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.println("Got message: " + message0.getText());
+ }
+ message0.acknowledge();
+
+ // Step 9. Receive the rest third of the sent messages but *do not* acknowledge them yet
+ for (int i = numMessages / 3; i < numMessages; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.println("Got message: " + message0.getText());
+ }
+
+ // Step 10. Crash server #1, the live server, and wait a little while to make sure
+ // it has really crashed
+ Thread.sleep(2000);
+ killServer(0);
+
+ // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
+ // backup server has occurred
+ try
+ {
+ message0.acknowledge();
+ }
+ catch (JMSException e)
+ {
+ System.err.println("Got exception while acknowledging message: " + e.getMessage());
+ }
+
+ // Step 12. Consume again the 2nd third of the messages again. Note that they are not considered as redelivered.
+ for (int i = numMessages / 3; i < (numMessages / 3) * 2; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
+ }
+ message0.acknowledge();
+
+ reStartServer(0, 10000);
+
+ Thread.sleep(10000);
+
+ // Step 11. Acknowledging the 2nd half of the sent messages will fail as failover to the
+ // backup server has occurred
+ try
+ {
+ message0.acknowledge();
+ }
+ catch (JMSException e)
+ {
+ System.err.println("Got exception while acknowledging message: " + e.getMessage());
+ }
+
+ // Step 12. Consume again the 2nd third of the messages again. Note that they are not considered as redelivered.
+ for (int i = (numMessages / 3) * 2; i < numMessages; i++)
+ {
+ message0 = (TextMessage)consumer.receive(5000);
+ System.out.printf("Got message: %s (redelivered?: %s)\n", message0.getText(), message0.getJMSRedelivered());
+ }
+ message0.acknowledge();
+
+ return true;
+ }
+ finally
+ {
+ // Step 13. Be sure to close our resources!
+
+ if (connection != null)
+ {
+ connection.close();
+ }
+
+ if (initialContext != null)
+ {
+ initialContext.close();
+ }
+ }
+ }
+
+}
View
82 ...ples/jms/replicated-failback/src/main/resources/hornetq/server0/hornetq-configuration.xml
@@ -0,0 +1,82 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
+
+ <clustered>true</clustered>
+
+ <bindings-directory>${build.directory}/server0/data/messaging/bindings</bindings-directory>
+
+ <journal-directory>${build.directory}/server0/data/messaging/journal</journal-directory>
+
+ <large-messages-directory>${build.directory}/server0/data/messaging/largemessages</large-messages-directory>
+
+ <paging-directory>${build.directory}/server0/data/messaging/paging</paging-directory>
+
+ <!--we kill the server process so don't need this set to true-->
+ <failover-on-shutdown>false</failover-on-shutdown>
+
+ <shared-store>false</shared-store>
+
+ <allow-failback>true</allow-failback>
+ <!-- Connectors -->
+ <failback-connectors>
+ <failback-connector>
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="port" value="5446"/>
+ </failback-connector>
+ </failback-connectors>
+
+ <connectors>
+ <connector name="netty-connector">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="port" value="5445"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <acceptor name="netty-acceptor">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+ <param key="port" value="5445"/>
+ </acceptor>
+ </acceptors>
+
+ <broadcast-groups>
+ <broadcast-group name="bg-group1">
+ <group-address>${udp-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>${udp-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>
+ <!--security for example queue-->
+ <security-setting match="jms.queue.exampleQueue">
+ <permission type="createDurableQueue" roles="guest"/>
+ <permission type="deleteDurableQueue" roles="guest"/>
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+</configuration>
View
33 examples/jms/replicated-failback/src/main/resources/hornetq/server0/hornetq-jms.xml
@@ -0,0 +1,33 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+ <!--the connection factory used by the example-->
+ <connection-factory name="ConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="netty-connector"/>
+ </connectors>
+
+ <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-->
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+</configuration>
View
7 examples/jms/replicated-failback/src/main/resources/hornetq/server0/hornetq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-users.xsd">
+ <!-- the default user. this is used where username is null-->
+ <defaultuser name="guest" password="guest">
+ <role name="guest"/>
+ </defaultuser>
+</configuration>
View
84 ...ples/jms/replicated-failback/src/main/resources/hornetq/server1/hornetq-configuration.xml
@@ -0,0 +1,84 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq ../../../../../../../hornetq-core/src/main/resources/schema/hornetq-configuration.xsd">
+
+ <live-connector-ref connector-name="netty-live-connector"/>
+
+ <clustered>true</clustered>
+
+ <bindings-directory>${build.directory}/server1/data/messaging/bindings</bindings-directory>
+
+ <journal-directory>${build.directory}/server1/data/messaging/journal</journal-directory>
+
+ <large-messages-directory>${build.directory}/server1/data/messaging/largemessages</large-messages-directory>
+
+ <paging-directory>${build.directory}/server1/data/messaging/paging</paging-directory>
+
+ <!--we kill the server process so don't need this set to true-->
+ <failover-on-shutdown>false</failover-on-shutdown>
+
+ <backup>true</backup>
+
+ <shared-store>false</shared-store>
+
+ <allow-failback>true</allow-failback>
+ <!-- Connectors -->
+
+ <connectors>
+ <connector name="netty-live-connector">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="port" value="5445"/>
+ </connector>
+ <connector name="netty-connector">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
+ <param key="port" value="5446"/>
+ </connector>
+ </connectors>
+
+ <!-- Acceptors -->
+ <acceptors>
+ <acceptor name="netty-acceptor">
+ <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
+ <param key="port" value="5446"/>
+ </acceptor>
+ </acceptors>
+
+ <broadcast-groups>
+ <broadcast-group name="bg-group1">
+ <group-address>${udp-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>${udp-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>
+ <!--security for example queue-->
+ <security-setting match="jms.queue.exampleQueue">
+ <permission type="createDurableQueue" roles="guest"/>
+ <permission type="deleteDurableQueue" roles="guest"/>
+ <permission type="createNonDurableQueue" roles="guest"/>
+ <permission type="deleteNonDurableQueue" roles="guest"/>
+ <permission type="consume" roles="guest"/>
+ <permission type="send" roles="guest"/>
+ </security-setting>
+ </security-settings>
+
+</configuration>
View
32 examples/jms/replicated-failback/src/main/resources/hornetq/server1/hornetq-jms.xml
@@ -0,0 +1,32 @@
+<configuration xmlns="urn:hornetq"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">
+ <!--the connection factory used by the example-->
+ <connection-factory name="ConnectionFactory">
+ <connectors>
+ <connector-ref connector-name="netty-connector"/>
+ </connectors>
+
+ <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-->
+ <queue name="exampleQueue">
+ <entry name="/queue/exampleQueue"/>
+ </queue>
+
+</configuration>
View
7 examples/jms/replicated-failback/src/main/resources/hornetq/server1/hornetq-users.xml
@@ -0,0 +1,7 @@
+<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:hornetq /schema/hornetq-users.xsd">
+ <!-- the default user. this is used where username is null-->
+ <defaultuser name="guest" password="guest">
+ <role name="guest"/>
+ </defaultuser>
+</configuration>
View
2 ...licated-transaction-failover/src/main/resources/hornetq/server0/hornetq-configuration.xml
@@ -15,7 +15,7 @@
<!--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>
+ <shared-store>false</shared-store>
<!-- Connectors -->

0 comments on commit 1af3b0a

Please sign in to comment.
Something went wrong with that request. Please try again.