activemq-artemis/examples/jms/clustered-standalone
Martyn Taylor 22d54c5830 [maven-release-plugin] prepare for next development iteration 2015-05-21 13:47:45 +01:00
..
src/main fixed examples and some docs after Artemis renaming 2015-04-30 10:44:16 +01:00
pom.xml [maven-release-plugin] prepare for next development iteration 2015-05-21 13:47:45 +01:00
readme.html added examples to release profile 2015-03-08 13:34:02 +00:00

readme.html

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF 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.
-->

<html>
  <head>
    <title>JMS Clustered Stand-alone 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 Clustered Stand-alone Example</h1>

     <p>This example demonstrates a JMS Topic deployed on three different nodes.
         The three nodes are configured to form a cluster.</p>
     <p>Subscribers for the topic are created on each node, and a producer is created on only one of the nodes.</p>
     <p>Some messages are sent by the producer, and we verify that <strong>all</strong> subscribers receive all the
     sent messages.</p>
     <p>This example uses ActiveMQ's default stand-alone clustered configuration.
        The relevant snippet from the server configuration, which tells the servers to form a cluster between the three nodes
     and to load balance the messages between the nodes is:</p>     
     <pre class="prettyprint">
     <code>&lt;cluster-connection name="my-cluster"&gt;
        &lt;address&gt;jms&lt;/address&gt;
        &lt;discovery-group-ref discovery-group-name="dg-group1"/&gt;
     &lt;/cluster-connection&gt;
     </code>
     </pre>    
     <h2>Example step-by-step</h2>
     <p><i>To run the example, simply type <code>mvn verify -Pexample</code> from this directory</i>. This will
        automatically start the 3 cluster nodes, each with its specific configuration.</p>
     <p>To start the tests <em>manually</em>, the following steps are:</p>
     <ul>
        <li>create 4 terminals (3 for the servers and 1 for the example client)</li>
        <li>in the first terminal, go to the <code>bin</code> directory and start the first server (with default configuration):
           <pre class="prettyprint"><code>./run.sh ../config/stand-alone/clustered</code></pre>
        <li>in the second terminal, start the second server:
           <pre class="prettyprint"><code>export CLUSTER_PROPS="-Ddata.dir=../data-server2 -Djnp.port=2099 -Djnp.rmiPort=2098 -Dactivemq.remoting.netty.port=6445 -Dactivemq.remoting.netty.batch.port=6455"
./run.sh ../config/stand-alone/clustered</code></pre>
        <li>in the third terminal, start the third server (with default configuration):
           <pre class="prettyprint"><code>export CLUSTER_PROPS="-Ddata.dir=../data-server3 -Djnp.port=3099 -Djnp.rmiPort=3098 -Dactivemq.remoting.netty.port=7445 -Dactivemq.remoting.netty.batch.port=7455"
./run.sh ../config/stand-alone/clustered</code></pre>
        <li>finally, in the fourth terminal, start the example
           <pre class="prettyprint"><code>./build.sh runRemote</code> (or <code>build.bat runRemote</code> on windows)</pre>
     <p>The example connects to the three cluster nodes using JNDI (which are retrieved from 
        <a href="server0/client-jndi.properties">server0</a>, <a href="server1/client-jndi.properties">server1</a>, and
        <a href="server2/client-jndi.properties">server2</a>' s JNDI properties file). The JNDI ports were specified
        using the environment property <code>jnp.port</code> (or 1098 by default) when starting the 3 cluster nodes.</p>
     
     <p>For a description of the example code, please read the <a href="../clustered-topic/readme.html">
        clustered-topic example</a> which is very similar (it has 2 nodes while this example has 3 nodes).

  </body>
</html>