activemq-artemis/examples/features/clustered/clustered-topic
Clebert Suconic b305e231ec [maven-release-plugin] prepare release 1.4.0 2016-09-06 12:17:08 -04:00
..
src/main Remove dead code 2016-01-11 13:21:26 -05:00
pom.xml [maven-release-plugin] prepare release 1.4.0 2016-09-06 12:17:08 -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 Clustered Topic 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 Topic 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 a JMS Topic deployed on two different nodes. The two nodes are configured to form a cluster.</p>
     <p>We then create a subscriber on the topic 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> subscribers receive all the
     sent messages.</p>
     <p>A JMS Topic is an example of <b>publish-subscribe</b> messaging where all subscribers receive all the
     messages sent to the topic (assuming they have no message selectors).</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>Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes
     and to load balance the messages between the nodes.</p>
     <pre class="prettyprint">
     <code>&lt;cluster-connection name="my-cluster"&gt;
        &lt;address&gt;jms&lt;/address&gt;
        &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>For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering
     section of the user manual.</p>
  </body>
</html>