WSO2 ESB ConcurrentConsumers and MaxConcurrentConsumers

Posted: August 25, 2014 in Uncategorized
Tags: , ,

When using WSO2 ESB as a JMS consumer you can use ConcurrentConsumers and MaxConcurrentConsumers properties to control the number of threads used to consume messages in the JMS queue or topic.

ConcurrentConsumers is the minimum number of threads for message consuming. If there are more messages to be consumed while those running threads are busy, then additional threads are started until total number of threads reaches MaxConcurrentConsumers. Simply saying, initially “ConcurrentConsumers” of threads are started in order to consume messages. Then if there are more message in the queue/topic yet to be consumed while running threads are busy, additional threads are started in order to consume the remaining messages. Like wise more threads are started untill total number of threads reaches “MaxConcurrentConsumers” number.

Below is a sample JMSListener configuration in axis2.xml. It tells use 5 threads intially and increase number of threads upto 20 according to the load.

<transportReceiver name="jms" class="org.apache.axis2.transport.jms.JMSListener"> 

        <parameter name="myTopicConnectionFactory" locked="false"> 
                <parameter locked="false" name="transport.jms.ConcurrentConsumers">5</parameter> 
                <parameter locked="false" name="transport.jms.MaxConcurrentConsumers">20</parameter> 
                <parameter name="java.naming.factory.initial" locked="false">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter> 
                <parameter name="java.naming.provider.url" locked="false">failover:tcp://localhost:61616</parameter> 
                <parameter name="transport.jms.ConnectionFactoryJNDIName" locked="false">TopicConnectionFactory</parameter> 
                    <parameter name="transport.jms.ConnectionFactoryType" locked="false">topic</parameter> 


Additionally you can override the values in axis.xml in your proxy too.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s