activemq-artemis/examples/features/clustered/symmetric-cluster
Clebert Suconic 6b17d966ce renaming broker-features -> features on examples 2015-08-13 00:11:56 -04:00
..
src/main renaming broker-features -> features on examples 2015-08-13 00:11:56 -04:00
pom.xml renaming broker-features -> features on examples 2015-08-13 00:11:56 -04:00
readme.html renaming broker-features -> features on examples 2015-08-13 00:11:56 -04: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>ActiveMQ Artemis JMS Symmetric Cluster 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 Symmetric Cluster Example</h1>

     <pre>To run the example, simply type <b>mvn verify</b> from this directory, <br>or <b>mvn -PnoServer verify</b> if you want to start and create the server manually.</pre>


     <p>This examples demonstrates a <b>symmetric cluster</b> set-up with ActiveMQ Artemis.</p>
     <p>ActiveMQ Artemis has extremely flexible clustering which allows you to set-up servers in
     many different topologies.</p>
     <p>The most common topology that you'll perhaps be familiar with if you are used to application
     server clustering is a <b>symmetric cluster</b>.</p>
     <p>With a symmetric cluster, the cluster is homogeneous, i.e. each node is configured the same
     as every other node, and every node is connected to every other node in the cluster.</p>
     <p>By connecting node in such a way, we can, from a JMS point of view, give the impression of distributed
     JMS queues and topics.</p>
     <p>The configuration used in this example is very similar to the configuration used by ActiveMQ
     when installed as a clustered profile in JBoss Application Server.</p>
     <p>To set up ActiveMQ Artemis to form a symmetric cluster we simply need to mark each server as <code>clustered</code>
     and we need to define a <code>cluster-connection</code> in <code>broker.xml</code>.</p>
     <p>The <code>cluster-connection</code> tells the nodes what other nodes to make connections to.
     With a <code>cluster-connection</code> each node that we connect to can either be specified
     indivually, or we can use UDP discovery to find out what other nodes are in the cluster.</p>
     <p>Using UDP discovery makes configuration simpler since we don't have to know what nodes are
     available at any one time.</p>
     <p>Here's the relevant snippet from the server configuration, which tells the server to form a cluster
     with the other nodes:</p>
     <pre class="prettyprint">
     <code>
   &lt;cluster-connection name="my-cluster"&gt;
      &lt;address&gt;jms&lt;/address&gt;
      &lt;connector-ref>netty-connector&lt;/connector-ref>
	   &lt;retry-interval&gt;500&lt;/retry-interval&gt;
	   &lt;use-duplicate-detection&gt;true&lt;/use-duplicate-detection&gt;
	   &lt;message-load-balancing&gt;STRICT&lt;/message-load-balancing&gt;
	   &lt;max-hops&gt;1&lt;/max-hops&gt;
	   &lt;discovery-group-ref discovery-group-name="my-discovery-group"/&gt;
   &lt;/cluster-connection&gt;
   </code>
     </pre>
     <p>In this example we create a symmetric cluster of six live nodes, and we also pair each live node
     with it's own backup node. (A backup node is not strictly necessary for a symmetric cluster).</p>
    <p>In this example will we will demonstrate this by deploying a JMS topic and Queue on all nodes of the cluster
     , sending messages to the queue and topic from different nodes, and verifying messages are received correctly
     by consumers on different nodes.</p>
    <p>For more information on configuring ActiveMQ Artemis clustering in general, please see the clustering
     section of the user manual.</p>
  </body>
</html>