activemq-artemis/examples/features/clustered/clustered-jgroups
Clebert Suconic c8982d775b [maven-release-plugin] prepare for next development iteration 2017-09-05 17:03:48 -04:00
..
src/main ARTEMIS-1371 update JGroups stack files 2017-08-25 22:46:13 -04:00
pom.xml [maven-release-plugin] prepare for next development iteration 2017-09-05 17:03:48 -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 Clustering with JGroups 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>ActiveMQ Artemis Clustering with JGroups 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 example demonstrates the working of a two node cluster using JGroups as the underlying topology broadcasting/discovery
     technique.</p>
     <p>We deploy a queue on to the cluster, then create a consumer on the queue on each node, and we create a producer on only one of the nodes.</p>
     <p>We then send some messages via the producer, and we verify that <b>both</b> consumers receive the sent messages
     in a round-robin fashion.</p>
     <p>This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use
     JNDI, these could be instantiated directly.</p>
     <p>To enable ActiveMQ Artemis to use JGroups you need to configure JGroups configuration file and make sure it is on the classpath
         by placing in the configuration directory, the file test-jgroups-file_ping.xml is the configuration used in this
     exaample</p>
     <p>You then configure the jgroups file used by the broadcast and discovery groups in the configuration along with the
         channel name which you want this cluster to share.</p>
     <pre class="prettyprint">
     <code>
   &lt;broadcast-groups&gt;
      &lt;broadcast-group name="my-broadcast-group">
         &lt;broadcast-period>5000&lt;/broadcast-period>
         &lt;jgroups-file>test-jgroups-file_ping.xml&lt;/jgroups-file>
         &lt;jgroups-channel>activemq_broadcast_channel&lt;/jgroups-channel>
         &lt;connector-ref>netty-connector&lt;/connector-ref>
      &lt;/broadcast-group>
   &lt;/broadcast-groups&gt;

   &lt;discovery-groups&gt;
      &lt;discovery-group name="my-discovery-group">
         &lt;jgroups-file>test-jgroups-file_ping.xml&lt;/jgroups-file>
         &lt;jgroups-channel>activemq_broadcast_channel&lt;/jgroups-channel>
         &lt;refresh-timeout>10000&lt;/refresh-timeout>
      &lt;/discovery-group>
   &lt;/discovery-groups&gt;
     </code>
     </pre>
     <p>For more information on ActiveMQ Artemis clustering in general, please see the clustering
     section of the user manual.</p>
  </body>
</html>