5 Replies Latest reply on Apr 25, 2014 8:37 AM by gaohoward

    Message redistribution with max-hops = 0

    liftiz

      I'm trying to set up a case where I have a HornetQ cluster (running inside clustered Wildfly) of a few nodes with the following pre-requisites, but can't get it to work

       

      - I have two queues available on all nodes, one is for incoming messages, one is for outgoing

      - I want to avoid load-balancing on the incoming, so I've set max-hops=0

      - I want to have message redistribution in the cluster to the node which has a consumer for the outgoing queue (only one of the nodes has a consumer)

       

      This does not work though, if I set max-hops=0 then message redistribution is effectively disabled. Max-hops=1 enables redistribution to the one node that has a consumer for the outgoing queue, but also enables load-balancing of the incoming queue. Can this be accomplished some other way? I need to have both queues on all nodes to facilitate failover handling, so I don't want to setup the nodes differently. It would be nice to have max-hops on a per-address setting like redistribution-delay, but it seems it's a global setting unfortunately.

       

      Any help or insight is appreciated.

        • 1. Re: Message redistribution with max-hops = 0
          gaohoward

          I think max-hops controls message redistribution, not load balancing. To avoid load balancing your client needs just to make a non-HA connection (for JMS you can configure the ConnectionFactory to not use ha). Setting max-hops affects all queues in the cluster. I'm not sure I understand why you don't want incoming queue message redistributed (is that what you meant by 'load balancing'?), can you describe a little more of your use case?

          • 2. Re: Message redistribution with max-hops = 0
            liftiz

            Max-hops is set on the cluster connection so it does indeed control the (server side) load-balancing - setting max-hops to 0 does disable load-balancing as well. I tried disabling HA on the connection factory, but to no avail (thanks for the tip though). In our case, the producer will also be using STOMP so the HA feature of the jms connection factory isn't even available (but still the problem occurrs).

             

            The case I have is for example two nodes, each have a separate, external producer sending message to the incoming queue. Since both nodes has it's own producer, load-balancing (and yes, I do mean server side load-balacing which is what HornetQ calls it in the documentation) is redundant, the load-balancing is handled by having the separate producer for each node. When replying to the message, I have an outgoing queue which is only consumed by a single consumer on one of the nodes.

             

            The queue/consumer/producer setup is not something I can change for now, so I'm just trying to find ways to deal with it.

            • 3. Re: Message redistribution with max-hops = 0
              gaohoward

              OK I got it. You want different server side load balancing for each queue. I think you can take a look at the cluster-connection configuration, e.g.

              <cluster-connections>

                                  <cluster-connection name="my-cluster">

                                      <address>jms</address>

                                      <connector-ref>http-connector</connector-ref>

                                      <discovery-group-ref discovery-group-name="dg-group1"/>

                                  </cluster-connection>

              </cluster-connections>

               

              Then create two cluster-connections based on the <address> scheme. for example you name your incoming queue as 'jms.queue.Incoming1" and outgoing queue as "jms.queue.Outgoing1",

              you then configure a 'my-cluster1' cluster connection, setting '<address>jms.queue.Incoming<address>' and another 'my-cluster2' setting <address>jms.queue.Outgoing</address>.

              You give one max-hops to 1 and the other 0.

               

              Can you try this and tell us if it works?

               

              Thanks

              Howard

              • 4. Re: Message redistribution with max-hops = 0
                liftiz

                Howard, that seems to have done it - thank you very much for you help!

                • 5. Re: Message redistribution with max-hops = 0
                  gaohoward

                  You are welcome.