Search code examples
jbosshornetq

HornetQ Clustering Specific Queue and Topic


I was using HorentQ in clustered mode in JBoss AS 7.1; However I wanted to see if I can cluster specific topics and queues only. I understood from this link that it is possible by configuring the address. However I am not able to find the address which works. Here is a snapshot of the doamin.xml; Where clustering is NOT working

              <cluster-connections>
                    <cluster-connection name="my-cluster">
                        <address>mro</address>
                        <connector-ref>netty</connector-ref>
                        <discovery-group-ref discovery-group-name="dg-group1"/>
                    </cluster-connection>
                </cluster-connections>

Here is how the Queue and topic is defined. Changing the address to jms makes everything clustered and it is working, but that is not what I want

                 <jms-queue name="MROQueue">
                        <entry name="mro/MROQueue"/>
                        <entry name="java:jboss/exported/mro/MROQueue"/>
                    </jms-queue>
                   <jms-topic name="MROTopic">
                        <entry name="mro/MROTopic"/>
                        <entry name="java:jboss/exported/mro/MROTopic"/>
                    </jms-topic>

Solution

  • I tried various wildcards in the address but nothing was working. So in the end got this working

     <cluster-connections>
                        <cluster-connection name="my-cluster">
                            <address>jms.queue.cluster</address>
                            <connector-ref>netty</connector-ref>
                            <discovery-group-ref discovery-group-name="dg-group1"/>
                        </cluster-connection>
                    </cluster-connections>
    

    and queues

    <jms-queue name="cluster.MROQueue">
                            <entry name="cluster.MROQueue"/>
                            <entry name="java:jboss/exported/cluster.MROQueue"/>
                        </jms-queue>
      <jms-topic name="cluster.MROTopic">
                            <entry name="cluster.MROTopic"/>
                            <entry name="java:jboss/exported/cluster.MROTopic"/>
                        </jms-topic>
    

    The above made both my Queues and Topics to be clustered. To test I changed to

     <cluster-connections>
                        <cluster-connection name="my-cluster">
                            <address>jms.queue.cluster3</address>
                            <connector-ref>netty</connector-ref>
                            <discovery-group-ref discovery-group-name="dg-group1"/>
                        </cluster-connection>
                    </cluster-connections>
    

    And changed queues to

     <jms-queue name="cluster2.MROQueue">
                            <entry name="cluster2.MROQueue"/>
                            <entry name="java:jboss/exported/cluster2.MROQueue"/>
                        </jms-queue>
    

    and it did not cluster; So that seems to be the way at least in this version for specific clustering