Why JBoss create only one ActiveMQ consumer?

948 views Asked by At

Why JBoss EAP 7 create only one consumer with Active MQ(not Artemis)? How to increase number of consumer?

I've tried:

  • increase maxSession ActivationConfigProperty
  • increase mdb pool size (via bean-instance-pools tag)
  • set min/max pool size inside connection-definition tag

My configuration:

mdb-pool configuration

<subsystem xmlns="urn:jboss:domain:ejb3:5.0">
...
<mdb>
    <resource-adapter-ref resource-adapter-name="com.icl.amq.jmsra.rar"/>
    <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>
</mdb>
<pools>
    <bean-instance-pools>
        <strict-max-pool name="slsb-strict-max-pool" max-pool-size="5" instance-acquisition-timeout="10" instance-acquisition-timeout-unit="MINUTES"/>
        <strict-max-pool name="mdb-strict-max-pool" max-pool-size="40" instance-acquisition-timeout="10" instance-acquisition-timeout-unit="MINUTES"/>
    </bean-instance-pools>
</pools>
...

resource-adapter configuration

<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
...
 <resource-adapter id="amq.jmsra.main">
    ...
     <connection-definitions>
         <connection-definition class-name="org.apache.activemq.ra.ActiveMQManagedConnectionFactory" jndi-name="${amq.jndi.factory}" enabled="true" pool-name="ConnectionFactory">
             <xa-pool>
                 <min-pool-size>10</min-pool-size>
                 <initial-pool-size>10</initial-pool-size>
                 <max-pool-size>35</max-pool-size>
             </xa-pool>
         </connection-definition>
     </connection-definitions>
 </resource-adapter>
...

MDB code:

@MessageDriven(activationConfig = {
        @ActivationConfigProperty(propertyName = "connectionFactoryLookup", propertyValue = "${amq.jndi.factory}"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "in_queue"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName="minSessions", propertyValue="5"),
        @ActivationConfigProperty(propertyName="maxSessions", propertyValue="40")
})
@ResourceAdapter("amq.jmsra.main")
public class ServerMessageListener implements MessageListener {
...

I expect this configuration increase number of consumers, however when viewing the status of queues from ActiveMQ web console I see only 1 consumer.

1

There are 1 answers

1
Justin Bertram On

It looks to me, based on the source-code of the ActiveMQ JCA RA, that sessions will be created on demand up to maxSessions based on message throughput. Therefore, if you simply start MDB and there are no messages to be consumed then I would expect just 1 session to be active.

Try putting Thread.sleep(5000); in your MDB's onMessage() and then push a couple thousand messages into the queue where its listening. I bet you'll see the consumer count increase as the JCA RA is forced to create new sessions to keep up with demand.