5 Replies Latest reply on Jan 19, 2011 9:56 AM by clebert.suconic

    Receive message many times

    asterisk

      Hallo,

       

      I have a problem with Jboss 5.1 GA and HornetQ 2.0 GA. I have a MDB that listenes to a topic. When I send a message to this topic from a client, the MDB receives this message many times (about 15 times). I have no idea where the problem is. To reproduce it, I have attached a modified example from the HornetQ distribution. To start it, you have to copy it to hornetq_dir/examples/javaee. It is called mdb-multi. This basically is the mdb-bmt example, but it uses a topic instead of a queue.

       

      Can anybody help me?

       

       

      Thank you!

        • 1. Receive message many times
          ataylor

          iirc this is a bug that has been fixed in the latest version

          • 2. Receive message many times
            timfox

            Are you sure you don't simply have 15 MDB instances consuming from the topic?

             

            With a topic, each consumer gets a copy of the message.

             

            IIRC default MDB pool size is something like 15.

            • 3. Receive message many times
              asterisk

              After checking the JMX console I can see 15 entries like this:

              address="jms.topic.testTopic",module=Core,name="1b8d41d5-a427-4b7e-a906-5bca437e2dbc",type=Queue

               

              So it seems you are right. Even if I wonder why type is Queue, it should be Topic, right?

               

              Is the behaviour of HornetQ different for topics than in JBoss messaging? I am actually migratin a big application from JBoss 4.0.4 to 5.1.

               

              Do I have to use a Topic or a Queue, if I want to trigger some parallel jobs using an MDB?

               

               

              Thanks!

              • 4. Receive message many times
                timfox

                The type should be Queue. In HornetQ each topic subscription is just a queue registered to the same address. (See user manual)

                 

                So, it looks like HornetQ is behaving correctly. You've created 15 topic subscriptions so each one will receive a copy of the message.

                 

                If you only want one MDB to receive a particular message deploy a JMS queue and set your MDB to consume from that.


                For more clarification on the differences between a queue and topic, the JMS spec and JMS tutorial (see wiki) are good places to start.

                • 5. Receive message many times
                  clebert.suconic

                  There was a bug on 2.0.GA's Resource adapter. It would create one one subscription for each instances on the MDB.

                   

                  It should be fixed on the latest released and trunk.