2 Replies Latest reply on Feb 18, 2004 9:10 PM by yxyang

    Question about queue, MDBs and threads

      hi, adrian

      what is the relation between queue, MDBs which watch the queue, and threads are running the MDB codes?

      I have a few MDBs (different class and do different businesses) which are watching a specific queue by using message selectors. I configed these MDBs to be singleton MDBs.
      My question is : how many threads will be used by jboss to deliver the messages to these MDBs? What i expected is that each singleton MDB will has one thread. So, for this specific queue, there are a few threads to do the message delivering. Is this assumption correct?
      Because if one queue has only one thread, then the performance will be decreased too much by employing singleton MDB.

      Regards
      yang

        • 1. Re: Question about queue, MDBs and threads

          If you have your singleton configured correctly,
          there is one server session to deliver messages.
          This uses a threadpool of size 1

          Regards,
          Adrian

          • 2. Re: Question about queue, MDBs and threads

            adrain

            my question is about the relation between thread, MDB and queue.

            First of the first is the definition of "singleton MDB", it is not "singleton Queue". Queue is always FIFO.

            Information of a MDB in ejb-jar.xml file includes two parts, one is the queue bound to, the second is the class/code that threads will runn through. In my understanding, "singleton" means that no more than one thread can run on the codes(exactly onMessage()) concurrently. And "singleton" has no relation with the queue. In the other hand, for a queue, it is possible that there are more than one singleton MDBs bound to it (in other words, more than one threads can read messages from the queue concurrently).

            Of course, it is possible to force to use one thread to deliever messages for the queue which has a singletonMDB bound to, but this constrains the usage of queue and also decrease the performance. I know the implementation also simple.

            Please give comments.

            thanks a lot.

            yang