19.2.2. Clustering HornetQ

HornetQ is used for all messaging. Right now HornetQ doesn't use JGroups for its cluster configuration so we must configure it separately from Infinispan. An example of configuring HornetQ to cluster without multicast is below.

Example 19.4. HornetQ Configuration ($JBOSS_HOME/standalone/configuration/standalone-ha.xml)

<server name="xyz" xmlns="urn:jboss:domain:1.1">
  <profile>
    ...
    <subsystem xmlns="urn:jboss:domain:messaging:1.1">
      <hornetq-server>
        ...
        <connectors>
          <netty-connector name="netty" socket-binding="messaging"/>
          ...
          <netty-connector name="server2-connector" socket-binding="messaging-server2"/>
          <netty-connector name="server3-connector" socket-binding="messaging-server3"/>
        </connectors>
        ...
        <cluster-connections>
          <cluster-connection name="default-cluster-connection">
            <address>
              jms
            </address>
            <connector-ref>
              netty
            </connector-ref>
            <retry-interval>
              500
            </retry-interval>
            <forward-when-no-consumers>
              true
            </forward-when-no-consumers>
            <static-connectors>
              <connector-ref>
                server2-connector
              </connector-ref>
              <connector-ref>
                server3-connector
              </connector-ref>
            </static-connectors>
          </cluster-connection>
        </cluster-connections>
        ...
      </hornetq-server>
    </subsystem>
    ...
  </profile>
  <socket-binding-group name="standard-sockets" default-interface="public">
    ...
    <socket-binding name="messaging" port="5445"/>
      ...
      <outbound-socket-binding name="messaging-server2">
        <remote-destination host="10.100.10.2" port="5445"/>
      </outbound-socket-binding>
      <outbound-socket-binding name="messaging-server3">
        <remote-destination host="10.100.10.3" port="5445"/>
      </outbound-socket-binding>
  </socket-binding-group>
</server>



Change the outbound socket binding hosts and ports to match your environment. The port should match the value of the messaging socket binding configured on each host. Each additional host needs the netty-connector, connector-ref under static-connectors, and outbound-socket-binding elements.