Question

I'm not able to configure Geronimo/ActiveMQ so that more then 10 Messages get processed at once.

I tried the suggestions from this mailing list, but setting the maxSessions to something higher than 10 doesn't have any effect. Setting it to something lower than that has an effect though...

Also I'tried to set the InstanceLimit by setting:

<module name="org.apache.geronimo.configs/j2ee-server/2.1.4/car">
    <gbean name="org.apache.geronimo.configs/j2ee-server/2.1.4/car?ServiceModule=org.apache.geronimo.configs/j2ee-server/2.1.4/car,j2eeType=GBean,name=CustomPropertiesGBean" 
           gbeanInfo="org.apache.geronimo.system.properties.SystemProperties">
        <attribute name="systemProperties">Default\ MDB\ Container.InstanceLimit=50</attribute>
    </gbean>
</module>
Was it helpful?

Solution

Okay, finally I got it! Here is a lengthy explanation, which hopefully will help someone too.

After tinkering around with these examples I figured out that the activation parameters of ActiveMQ doesnt limit the upper bound, we can reduce the parallel instance though:

<activation-config-property>
    <activation-config-property-name>destinationType</activation-config-property-name>
    <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
</activation-config-property>
<activation-config-property>
    <activation-config-property-name>maxSessions</activation-config-property-name>
    <activation-config-property-value>3</activation-config-property-value>
</activation-config-property>
<activation-config-property>
    <activation-config-property-name>maxMessagesPerSessions</activation-config-property-name>
    <activation-config-property-value>2</activation-config-property-value>
</activation-config-property>

So I decided to go down the road of OpenSource! After attaching all needed source code of the involved components:

  • Geronimo
  • ActiveMQ
  • OpenEJB

and going up the stacktrace I figured out, that the InstanceLimit is a GBean Property which is explicitly queried. Its default value is 10, which is hardcoded in Geronimo. By tweeking this value in the debugger I got the wished results!

But setting the InstanceLimit was also suggested in the mailing list which suggested to add this to Geronimos config.xml

<module name="org.apache.geronimo.configs/j2ee-server/2.1.4/car">
    <gbean name="org.apache.geronimo.configs/j2ee-server/2.1.4/car?ServiceModule=org.apache.geronimo.configs/j2ee-server/2.1.4/car,j2eeType=GBean,name=CustomPropertiesGBean" 
           gbeanInfo="org.apache.geronimo.system.properties.SystemProperties">
        <attribute name="systemProperties">Default\ MDB\ Container.InstanceLimit=50</attribute>
     </gbean>
</module>

(Of course with the correct version numbers) But this doesn't had any effect. After carefully rereading this hint:

Try setting the InstanceLimit property of the MdbContainer to 0 so that the no of instances created matches the no of AMQ sessions available. For setting this you need to set this as a system property.The property should be containerId.InstanceLimit where containerId is of the format

<artifactId>.<Resource Group Name>-<listener interface>

eg: org.apache.geronimo.configs/activemq-ra/2.2-SNAPSHOT/car.ActiveMQ RA-javax.jms.MessageListener

  • <artifactId> = artifactId of the jms RA
  • <Resource Group Name> - The resource Group name u gave while creating the RA
  • <listener interface> - javax.jms.MessageListener in this case

and examining Geronimos code and runtime state I figured out it was looking for the InstanceLimit in org.apache.geronimo.openejb.OpenEjbSystemGBean line 309, with a destinct ID which was in the example project:

org.apache.geronimo.configs/activemq-ra/2.2.1/car.ActiveMQ RA-javax.jms.MessageListener

Equiped with this information i gave this a try:

<module name="org.apache.geronimo.configs/j2ee-server/2.2.1/car">
    <gbean name="org.apache.geronimo.configs/j2ee-server/2.2.1/car?ServiceModule=org.apache.geronimo.configs/j2ee-server/2.2.1/car,j2eeType=GBean,name=CustomPropertiesGBean" 
               gbeanInfo="org.apache.geronimo.system.properties.SystemProperties">
        <attribute name="systemProperties">org.apache.geronimo.configs/activemq-ra/2.2.1/car.ActiveMQ\ RA-javax.jms.MessageListener.InstanceLimit=50</attribute>
    </gbean>
</module>

and it worked! Whereby I got the used ID from the debugging session... Now we can set InstanceLimit=0 and can configured the parallel working MDB by the maxSessions property of ActiveMQ!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top