8 Replies Latest reply on Feb 23, 2011 8:28 AM by esanmartin Branched from an earlier discussion.

    Parameterizing max-rate producers through the Resource Adapter

    esanmartin

      I have another question (i think that is related to this topic), but i will explain what i'm trying to so you can say me if there are a better way to do that with hornetq:

       

      The problem is that we need to send message to differents queues at different rates per queue (like Queue1 at rate1, Queue2 at rate2, queueN at rateN) like i explain in a previously post, so, one solution it's to setup the rate at the RA in the ra.xml file but i was trying to do this at the ejb-jar.xml config or in the jboss.xml, so i find this options for another JCA adapters:

       

      http://onjava.com/pub/a/onjava/2004/06/23/mdbjca.html?page=2

       

      <activation-config-property>

                <activation-config-property-name>

                    ConnectionFactoryJndiName

                </activation-config-property-name

      </activation-config-property>

       

      Is there someway to setup the connection factory of the MDB at this level (in the ejb.jar.xml or jboss.xml)? I try to setup the:

       

      <activation-config-property>

                                                  <activation-config-property-name>providerAdapterJNDI</activation-config-property-name>

                                                  <activation-config-property-value>java:/Rate1JMSProvider</activation-config-property-value>

                                              </activation-config-property>

       

      In the ejb-jar.xml and in the jms-ds.xml i setup the Rate1JMSProvider using the connection factory that i want to setup, but, the MDB still consume the messages at no limit rate, what can i do?

       

      Regards

        • 1. Re: Parameterizing max-rate producers through the Resource Adapter
          clebert.suconic

          I branched this to a different thread as I thought you were "hijacking" the thread to a slightly different question... ;-)

           

           

          Sem ofensas :-)

          • 2. Re: Parameterizing max-rate producers through the Resource Adapter
            clebert.suconic

            The producer max-rate is determined at the Connection Factory, not at the Queue level.

             

             

            You should probably have to create two instances of the RA.xml each one on different bindings.

             

             

             

            We have a feature request already on user quotas, and that would probably supply this kind of request.

            • 3. Re: Parameterizing max-rate producers through the Resource Adapter
              esanmartin

              Thanks Clebert (again), that's interesting, how i can have 2 instance of the ra.xml? should i create a copy of the jms-ra.rar and then change the ra.xml? is there a better way to do that? (like only change the ra.xml and not have two copy's of the jms-ra.rar)

               

              Regards

              • 4. Re: Parameterizing max-rate producers through the Resource Adapter
                ataylor

                you dont need another ra.xml, basically this is the default, you can override any of the connection factory properties via the activation config, either on the MDB like

                 

                @ActivationConfigProperty(propertyName = "producerMaxRate", propertyValue = "12345")

                 

                or using the xml config but im not 100%  on how you do that

                • 5. Re: Parameterizing max-rate producers through the Resource Adapter
                  esanmartin

                  Thank's Andy, well i try to setup the consumer (and the producer but in my case the MDB have to "consume" at some rate) in the ejb-jar.xml with this propertie:

                   

                    <activation-config>

                      <activation-config-property>

                        <activation-config-property-name>consumerMaxRate</activation-config-property-name> <!-- i also try with the producerMaxRate -->

                        <activation-config-property-value>2</activation-config-property-value>

                      </activation-config-property>

                    </activation-config>

                   

                   

                  I have no luck with this, so i will try to create another instance of the ra.xml...

                  • 6. Re: Parameterizing max-rate producers through the Resource Adapter
                    esanmartin

                    Well after all day doing sftw and rtfm i try to setup this propertie in the ra.xml but i have no luck, the problems it's very weird because in the first test it's seems to be send the message at the rate that was setted, but when i start to doing more test, the rate go to the maximun that a consumer can fecth a messagge.

                     

                    The ejb-jar.xml have this mdb configured:

                     

                    <message-driven>

                              <display-name>TestSenderMDB</display-name>

                              <ejb-name>TestSenderEJB</ejb-name>

                              <ejb-class>com.atichile.smsgateway.senders.kannel.TestSenderMDB</ejb-class>

                              <transaction-type>Container</transaction-type>

                              <message-driven-destination>

                                        <destination-type>javax.jms.Queue</destination-type>

                              </message-driven-destination>

                     

                              <activation-config>

                                        <activation-config-property>

                                                  <activation-config-property-name>maxSession</activation-config-property-name>

                                                  <activation-config-property-value>1</activation-config-property-value>

                                        </activation-config-property>

                              </activation-config>

                    </message-driven>

                     

                    and in the ra.xml for that ejb i setup the "maxConsumerRate" at the desired rate... what i can do to fix the problem with the rate?

                    • 7. Re: Parameterizing max-rate producers through the Resource Adapter
                      ataylor

                      Just tested this on trunk and it works fine for me, i simple set the activation property as such

                       

                      @ActivationConfigProperty(propertyName = "consumerMaxRate", propertyValue = "1")

                       

                      and the MDB's consumed at 1 msg per second

                      • 8. Re: Parameterizing max-rate producers through the Resource Adapter
                        esanmartin

                        yeah, so if you want to get a rate of 1 msg/s you have to setup the pool of MDB at 1 like:

                         

                        @ActivationConfigProperty(propertyName = "consumerMaxRate", propertyValue = "1"),

                        @ActivationConfigProperty(propertyName = "maxSession", propertyValue = "1")