3 Replies Latest reply: Aug 16, 2004 7:13 AM by Renen W RSS

    configuration-name / How to limit MDB instances

    Renen W Newbie

      I would be very appreciative if somebody clue me in on how to restrict the number of MDB instances serving a queue.

      The following: http://www.junlu.com/msg/41859.html offers some hints. But if it answer's my question, I'm missing something obvious.

      Thanks in advance.

      Renen.

        • 1. Re: configuration-name / How to limit MDB instances
          Elias Ross Master


          Yes. Do a little cut&pasting of standardjboss.xml and create your own configuration similar to the SingletonMessageDrivenBean.

          • 2. Re: configuration-name / How to limit MDB instances
            Stephane Nicoll Master

            Adrian posted a solution in the FAQ.

            Regards,

            Stephane

            • 3. Re: configuration-name / How to limit MDB instances
              Renen W Newbie

              Hello.

              Thanks to both genman and Stephane.

              I'm afraid that I'm a bit of a lowbrow when it comes to these kinds of things. I was not able to easily figure out from Adrian's FAQ how I should proceed. It was useful only in that it pointed me in the right direction, but genman's contribution was more useful.

              For future generations, what you do to control the number of instances of an MDB are servicing a queue, is define your jboss.xml as follows:


              <jboss>
              
               <unauthenticated-principal>nobody</unauthenticated-principal>
              
               <invoker-proxy-bindings>
               <invoker-proxy-binding>
               <name>email-message-driven-bean</name>
               <invoker-mbean>default</invoker-mbean>
               <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
               <proxy-factory-config>
               <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
               <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
               <MaximumSize>4</MaximumSize>
               <MaxMessages>1</MaxMessages>
               <MDBConfig>
               <ReconnectIntervalSec>10</ReconnectIntervalSec>
               <DLQConfig>
               <DestinationQueue>queue/DLQ</DestinationQueue>
               <MaxTimesRedelivered>10</MaxTimesRedelivered>
               <TimeToLive>0</TimeToLive>
               </DLQConfig>
               </MDBConfig>
               </proxy-factory-config>
               </invoker-proxy-binding>
               </invoker-proxy-bindings>
              
               <enterprise-beans>
              
               <message-driven>
               <ejb-name>MailHandler</ejb-name>
               <configuration-name>Standard Message Driven Bean</configuration-name>
               <destination-jndi-name>queue/mailQueue</destination-jndi-name>
               <invoker-bindings>
               <invoker>
               <invoker-proxy-binding-name>email-message-driven-bean</invoker-proxy-binding-name>
               </invoker>
               </invoker-bindings>
              
               </message-driven>
              
               </enterprise-beans>
              
               <resource-managers>
               </resource-managers>
              
              </jboss>
              


              The bit that matters is the line
              <MaximumSize>4</MaximumSize>


              Just to make things quite clear: the file jboss.xml sits in the META-INF directory of the jar in which your MDB lives.

              I hope I got that right! Clearly I'm new to JMS, so if there are better ways of killing this cat, please let me know.

              Renen.