6 Replies Latest reply on Jun 26, 2015 7:04 AM by ataylor

    HornetQ clustering, all nodes process message

    craigmjones96

      Hi,

       

      I am using Wildfly and the embedded HornetQ. My plan is to cluster the HornetQ servers and I was wondering if the following is possible, and if not, is there an alternative solution?

       

      Say i have two nodes in my HornetQ cluster, I have the following two scenarios:

       

      - I want a message to come in and be delivered to one node and processed by one MDB consuming the topic (this seems pretty straight forward and out of the box round robin setup).

      - I want a message to come in and be delivered to BOTH nodes and processed by one MDB consuming the topic on BOTH nodes (this i'm not sure about).

       

      Is anyone able to help point me in the right direction?

       

      Thanks

        • 1. Re: HornetQ clustering, all nodes process message
          jbertram

          If you want just one MDB in the cluster to receive the message then configure the relevant MDBs to consume from the same queue.

           

          Each MDB subscribed to the same topic in a cluster will get any message sent to that topic assuming the subscription is either non-durable or if it's durable they MDBs use unique subscription names.

          • 2. Re: HornetQ clustering, all nodes process message
            craigmjones96

            Thanks for the reply Justin.

             

            I feel i may not have been very clear in my description.

             

            Lets say i build an application that has one MDB in it and its set up to listen to a topic called myTopic (it is a durable subscription). I then deploy this to two Wildfly application servers (A and B) that are set up for full HA and have the underlying hornetq server nodes in a cluster.

             

            My understanding is that if a message came into the system, the round robin approach would chose one of the hornetq nodes and the message would be processed by the MDB on that same application server (the other server would not do anything with the message). Is this correct?

             

            What i would like to be able to configure is for the MDB on both application servers to process the same message. Maybe its better to state i would want both hornetq nodes to process the message?

            • 3. Re: HornetQ clustering, all nodes process message
              jbertram

              My understanding is that if a message came into the system, the round robin approach would chose one of the hornetq nodes and the message would be processed by the MDB on that same application server (the other server would not do anything with the message). Is this correct?

              If you have a MDB configured to use a durable subscription and that exact same MDB is deployed to two different clustered nodes then yes only one of those MDBs would receive any particular message sent to the topic.

               

              What i would like to be able to configure is for the MDB on both application servers to process the same message. Maybe its better to state i would want both hornetq nodes to process the message?

              In order to do that you'd need for each MDB to use a different subscription name.

              • 4. Re: HornetQ clustering, all nodes process message
                craigmjones96

                Is there no replication functionality available to replicate a message across multiple nodes?

                 

                I have read on posts a few years old that people have asked the same question and there was a hint that it may be future functionality.

                 

                The only replication i can see right now is between a live and backup instance.

                 

                Would diverts and bridges be a way to go? or is there a way of using jgroups?

                 

                Sorry for further questions, im just really trying to solve this in the hornetq configuration before having to go down some other route.

                • 5. Re: HornetQ clustering, all nodes process message
                  jbertram

                  Is there no replication functionality available to replicate a message across multiple nodes?...The only replication i can see right now is between a live and backup instance.

                  Yes, replication is supported.  Yes, replication is only between a live and a backup.  If you replicated messages between live servers you'd simply end up with duplicate messages.

                   

                  Would diverts and bridges be a way to go? or is there a way of using jgroups?

                   

                  Sorry for further questions, im just really trying to solve this in the hornetq configuration before having to go down some other route.

                  I'm not clear on what exactly you want to achieve.  What is your specific goal here?

                  • 6. Re: HornetQ clustering, all nodes process message
                    ataylor

                    Please dont hijack other peoples posts as it gets confusing. raise a new post with your question.