Skip to content

Cluster Setup (N-Node)

This guide explains how to configure a JMS Bridge cluster with N broker nodes using static connectors in ActiveMQ Artemis. This approach is ideal for controlled deployments with known broker endpoints.

A cluster enables:

  • Load balancing of messages across broker nodes
  • Failover handling if a node goes down
  • Horizontal scalability for high-throughput systems
  • Message redistribution for active consumers

Each broker node connects to every other node via TCP connectors.

Broker-1 <----> Broker-2
| |
| |
Broker-3 <----> ... <----> Broker-N

This forms a full-mesh topology using static TCP connectors.


Each node must define a self connector and static connectors for the other N–1 nodes.

Example for Broker-1:

<connectors>
<connector name="self">tcp://broker1-host:61616</connector>
<connector name="broker2">tcp://broker2-host:61617</connector>
<connector name="broker3">tcp://broker3-host:61618</connector>
<!-- Add additional connectors up to broker-N -->
</connectors>

Do not include self in the static connectors list.

Use a <cluster-connection> to link nodes. Example for Broker-1:

<cluster-connections>
<cluster-connection name="jms-cluster">
<connector-ref>self</connector-ref>
<retry-interval>1000</retry-interval>
<message-load-balancing>STRICT</message-load-balancing>
<max-hops>1</max-hops>
<static-connectors>
<connector-ref>broker2</connector-ref>
<connector-ref>broker3</connector-ref>
<!-- Up to broker-N -->
</static-connectors>
</cluster-connection>
</cluster-connections>

Repeat on every broker, changing the self connector and static-connectors accordingly.


Set redistribution so messages are forwarded to nodes with active consumers:

<address-settings>
<address-setting match="#">
<redistribution-delay>0</redistribution-delay>
</address-setting>
</address-settings>

  1. Start all broker nodes.
  2. Send a message to any node.
  3. Consume it from another node connected to the same queue.

  • Use unique ports for each broker (e.g., 61616, 61617, …).
  • Use meaningful connector names for clarity.
  • Keep cluster topology symmetric (every node knows all others).
  • Use message-load-balancing=STRICT to optimize routing.

To quickly generate <connector-ref> blocks for N nodes:

Terminal window
for i in $(seq 2 20); do
echo "<connector-ref>broker$i</connector-ref>"
done