1 Reply Latest reply on Feb 2, 2012 5:43 AM by jaikiran

    Change "maxSession" ActivationConfigProperty dynamically on MDB

    hushen.savani

      Hi Community,

       

           I am using JBossAS-5.1.0.GA with HornetQ-2.2.5.Final. I am using Message Driven Beans in my application. I wanted to configure MDBs maxSession and maxPoolSize configurable instead of hardcoding inside the code. So, I have converted my MDB to AspectDomain and configured parameters in *-aop.xml. Following is my sample-aop.xml file:

       

      sample-aop.xml:

       

      <?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="30")})
            </annotation>
        
           <annotation expr="class(*) AND !class(@org.jboss.ejb3.annotation.Pool)">
               @org.jboss.ejb3.annotation.Pool (value="StrictMaxPool", maxSize=30, timeout=1000000)
            </annotation>
      
         </domain>
      
      <domain name="HornetQSessionBean" extends="Stateless Bean" inheritBindings="true">
            <annotation expr="!class(@org.jboss.annotation.ejb.PoolClass)">
                @org.jboss.annotation.ejb.PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=20000, timeout=10000)
            </annotation>
         </domain>
      </aop>
      

       

       

      And My Message Driven Bean is as following:

       

      @MessageDriven
      @AspectDomain("ProcessingEntitiesQueueListenerMDB")
      @TransactionManagement(value= TransactionManagementType.CONTAINER)
      @TransactionAttribute(value= TransactionAttributeType.NOT_SUPPORTED)
      @ResourceAdapter("hornetq-ra.rar")
      public class ProcessingEntitiesQueueListenerMDB implements MessageListener { 
           ......
           ......
           .....
      }
      

       

      After deploying the sample-aop.xml, I am able to control these parameters as per I configure.

       

      Now, what happens here is that, if I chage maxSession/max Pool size equals to 40 from 30 on runtime, the changes are not reflected dynamically. Hence, I tried redeploying sample-aop.xml on runtime. But again, new values to these parameters are not bound to my MDB on runtime.

       

      Pl. suggest some pointers on the same to change these binding dynamically on runtime.

       

      Thank you.

       

      Best Regards,

      Hushen Savani