5 Replies Latest reply on Mar 23, 2012 2:59 PM by vkopichenko

    Set "maxSession" of an MDB using XML instead of Annotations

    hushen.savani

      Hi,

       

      I having an application developed on the apis of Hornetq-2.2.5 with AppServer JBossAS-5.1.0. And with EJB3 implementaion.

       

      I am trying to set "maxSession" parameter of an MDB using xml instead of annotations. I've set the following parameters

       

      In standardjboss.xml :

       

      1) maxSession -> 20 in jms-message-inflow-driven-bean <invoker-proxy-binding>

      2) MaximumSize -> 20 in message-driven-bean <invoker-proxy-binding>

       

      In ejb3-interceptors-aop.xml

       

      1) maxSize -> 20 in Message Driven Bean <domain> for Pool Annotation.

       

      But, the changes are not reflected, max session are created as 15, which is the default value of the maxSession of an MDB. According to following JBoss Doc, http://docs.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/5/html/HornetQ_User_Guide/ch32s03.html

       

      it says that, in order the changes to be reflected, you need to set the maxSession parameter either on the resource adapter itself or via an an Activation Config Property on the MDB itself.

       

      I tried digging out the Hornetq Resource Adapter (ra.xml), but I find no clue where to set it. Pl. have a pointers on the same.

       

      Thanks.

        • 1. Re: Set "maxSession" of an MDB using XML instead of Annotations
          jaikiran

          Hushen Savani wrote:

          it says that, in order the changes to be reflected, you need to set the maxSession parameter either on the resource adapter itself or via an an Activation Config Property on the MDB itself.

           

          See this example on how you can set it as an activation config property in ejb-jar.xml http://docs.jboss.org/ejb3/docs/tutorial/1.0.7/html/Message_Driven_Beans_with_deployment_descriptor.html

          • 2. Re: Set "maxSession" of an MDB using XML instead of Annotations
            hushen.savani

            Hi Jaikiran,

             

            Thanks, but this won't help either. Because, I want to configure maxSession dynamically, I don't want it be tightly bound with my application ear. I just want to configure inside the jboss xml files, not in ejb-jar.xml as this xml will wrapped inside my ear. Hence, don't want it be shipped with my ear.

            • 3. Re: Set "maxSession" of an MDB using XML instead of Annotations
              hushen.savani

              Pl. provide the pointer on the same.

               

              Thanks :-)

              • 4. Re: Set "maxSession" of an MDB using XML instead of Annotations
                hushen.savani

                Hi,

                 

                Finally, I have found the solution of the above problem.

                 

                I have created a {****}-aop.xml file as following :

                 

                <?xml version="1.0" encoding="UTF-8"?>

                <aop xmlns="urn:jboss:aop-beans:1.0">

                    <domain name="ProcessingEntitiesQueueListenerMDB" extends="Message Driven Bean" inheritBindings="true">

                      <annotation expr="!class(@org.jboss.ejb3.annotation.DefaultActivationSpecs)">

                         @org.jboss.ejb3.annotation.DefaultActivationSpecs (value={@javax.ejb.ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"), @javax.ejb.ActivationConfigProperty(propertyName="destination", propertyValue="queue/mocmProcessingQueue"), @javax.ejb.ActivationConfigProperty(propertyName="maxSession", propertyValue="20")})

                      </annotation>

                   </domain>

                </aop>

                 

                and have placed the same file in deploy dir.

                 

                And the annotations in Message Driven Bean has been set as following:

                 

                @MessageDriven

                @AspectDomain("ProcessingEntitiesQueueListenerMDB")

                @ResourceAdapter("hornetq-ra.rar")

                public class ProcessingEntitiesQueueListenerMDB extends MessageServiceListenerSessionBase implements MessageListener {

                          ........

                          .......     

                }

                • 5. Re: Set "maxSession" of an MDB using XML instead of Annotations
                  vkopichenko

                  I've also tried to find a way to externalize the maxSession property out of ear.

                  But had no success with this solution under JBoss 4.2.3.GA. DefaultActivationSpecs were not taken into account.

                   

                  Extensive googling gave a hint to alternative solution with using system properties in ejb-jar.xml. It works with all versions before JBoss AS 7.

                  So now I can just update property in deploy/properties-service.xml then touch ear to redeploy and new setting gets applied.

                  No full JBoss restart is needed.