JMS Clustered Stand-alone Example

This example demonstrates a JMS Topic deployed on three different nodes. The three nodes are configured to form a cluster.

Subscribers for the topic are created on each node, and a producer is created on only one of the nodes.

Some messages are sent by the producer, and we verify that all subscribers receive all the sent messages.

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:

     <cluster-connection name="my-cluster">
        <address>jms</address>
        <discovery-group-ref discovery-group-name="dg-group1"/>
     </cluster-connection>
     
     

Example step-by-step

To run the example, simply type mvn verify -Pexample from this directory. This will automatically start the 3 cluster nodes, each with its specific configuration.

To start the tests manually, the following steps are: