11 Replies Latest reply on Mar 21, 2012 12:15 PM by hushen.savani

    Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime

    hushen.savani

      Hi Community,

       

           I am running my application on JBossAS-5.1.0.GA with HornetQ-2.2.5.Final. I have a requirement on production for changing value of "maxSession" property of ActivationConfigSpecs of an MDB on runtime. I have posted similer thread on EJB3 forum, but didn't get much of the help on the same. I want to ask Hornetq experts that can we call methods of org.hornetq.ra.inflow.HornetQActivationSpec on runtime (i.e. call setMaxSession()) in order to change value of "maxSession" of an MDB dynamically on runtime? Pl. suggest on the same on urgent basis.

       

           Thank you very much.

       

      Best Regards,

      Hushen Savani

        • 1. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
          ataylor

          No, all you could do would be to undeploy and redeploy your mdb

          • 2. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
            hushen.savani

            Hi Andy,

             

                 I tried redeploying my ear (as unable to redeploy my mdb only) from jmx-console, but it throws weired errors on runtime redeployment as following, as application is heavily using this mdb. And then application crashes after exceptions.

             

            2012-02-01 14:56:22,759 ERROR [org.hornetq.ra.inflow.HornetQMessageHandler] (Thread-78 (group:HornetQ-client-global-threads-235812787)) Failed to deliver message

            java.lang.RuntimeException: Unable to inject jndi dependency: env/com.elitecore.messageservice.ejb.messageserviceengine.messageservicelistener.mdb.ManagementQueueListenerMDB/messageServiceProviderRemote into property com.elitecore.messageservice.ejb.messageserviceengine.messageservicelistener.mdb.ManagementQueueListenerMDB.messageServiceProviderRemote: MessageServiceProviderSessionFacadeRemote not bound

                      at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82)

                      at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99)

                      at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89)

                      at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61)

                      at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:89)

                      at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:83)

                      at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)

                      at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:74)

                      at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1086)

                      at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:83)

                      at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:56)

                      at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:51)

                      at org.jboss.ejb3.pool.ThreadlocalPool.create(ThreadlocalPool.java:53)

                      at org.jboss.ejb3.pool.ThreadlocalPool.get(ThreadlocalPool.java:93)

                      at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.aspects.tx.TxPolicy.invokeInNoTx(TxPolicy.java:66)

                      at org.jboss.ejb3.tx.TxInterceptor$NotSupported.invoke(TxInterceptor.java:114)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:80)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)

                      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

                      at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:282)

                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:270)

                      at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:140)

                      at $Proxy285.onMessage(Unknown Source)

                      at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278)

                      at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:866)

                      at org.hornetq.core.client.impl.ClientConsumerImpl.access$100(ClientConsumerImpl.java:44)

                      at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:983)

                      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                      at java.lang.Thread.run(Thread.java:619)

            Caused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: MessageServiceProviderSessionFacadeRemote not bound]

                      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1352)

                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:817)

                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

                      at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44)

                      at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75)

                      ... 38 more

            Caused by: javax.naming.NameNotFoundException: MessageServiceProviderSessionFacadeRemote not bound

                      at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)

                      at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)

                      at org.jnp.server.NamingServer.getObject(NamingServer.java:785)

                      at org.jnp.server.NamingServer.lookup(NamingServer.java:443)

                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)

                      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

                      at javax.naming.InitialContext.lookup(InitialContext.java:392)

                      at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1346)

                      ... 42 more

             

             

                 Can there be any work around to change the "maxSession" of an mdb???

             

                 Pls. suggest. Thank you.

             

            Best Regards,

            Hushen Savani

            • 3. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
              ataylor

              looks like an AS issue, so i cant really comment.

               

              regarding maxSessions, this is used at deply time to control how many sessions are created to feed the MDB's, it doesnt really make sense to change it dynamically. what are you trying to acheive anyway, if its flow control then use consumer flow control.

              • 4. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                hushen.savani

                Hi Andy,

                 

                     In my application, I have a business flow that my application makes an RMI call on each message, to another application deployed on another JBoss App.Server to perform business logic. My application is just a middleware.

                 

                     i.e.:

                    

                public void onMessage(Message msg) {

                 

                          ......

                          ......         

                 

                          String messageStatus = sendMessageToOtherAppServerForBusinessProcessing(msg);

                 

                          if(messageStatus.equals("XYZ")) {

                               enqueueMessageInTheSameQueueOfMyApp(msg);             

                          }   


                          ......

                          ......         

                 

                     }

                 

                     Hence, on each message, my application makes remote call to another app server to process the business processing. While the other server is slow in process, if I set "maxSession" very high on my mdb, then the other server will be hit with so many remote requests and will go more slow. If I set maxSession very less, then other server will remain idle. Also, the other server is behaving arbitarily on the basis of load it is having. So, I want to make an utility for my application that will auto-adjust the value of maxSession on run time so that if the other server is slow, less remote calls will be sent, else more remote calls will be made on each message on MDB.

                 

                     Pl. suggest.

                 

                     Thanks.

                 

                Best Regards,

                Hushen Savani

                • 5. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                  ataylor

                  i dont really understand what you are doing however chamging the number of sessions is probably the wrong way to go about it. I think you basically need to have some flow control at the target server, maybe another layer at the targer server. you could have a queue here that feeds the process and control how fast it can receive messages via flow control.

                  • 6. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                    hushen.savani

                    Hi Andy,

                     

                         Thanks. I will think of working on what you suggested. By the way, If I will use the MessageConsumer instead of an MDB, will I be able to auto-adjust message consumption concurrency on runtime?

                     

                    Best Regards,

                    Hushen Savani

                    • 7. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                      ataylor

                      you can control message flow control in both consumers and MDB's.

                      1 of 1 people found this helpful
                      • 8. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                        hushen.savani

                        Ok Thanks Andy, I will try changing consumer rate (flow control) on runtime without restarting application server. 

                        • 9. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                          ataylor

                          changing it at runtime wont be possible, what i mean is this

                           

                          client -> source server queue -> onMessage -> targetsertver queue -> business process via MDB

                           

                          if you set producer flow control to block between source server and target server you can control how many messages get sent to the business process

                          1 of 1 people found this helpful
                          • 10. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                            t3rm1

                            I have the same problem. I have a queue with a lot  messages (~61 million) and I need to control how fast these messages are executed. I have to control this at runtime because the conditions change.

                            Did I understand you correctly that this is not possible?

                            • 11. Re: Changing "maxSession" of an MDB dymanically using HornetQActivationSpec on runtime
                              hushen.savani

                              Hi t3rm1,

                               

                                   You can't do it on runtime. You'll have to redeploy your MDB.

                               

                              Best Regards,

                              Hushen Savani